Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ cache:
- node_modules
- vendor
- $HOME/.composer/cache
- $HOME/opt/$TRAVIS_PHP_VERSION
env:
global:
- WP_TRAVISCI=travis:phpunit
Expand Down Expand Up @@ -35,6 +36,8 @@ before_install:
sed -i "s/yourusernamehere/root/" wp-tests-config.php
sed -i "s/yourpasswordhere//" wp-tests-config.php
svn checkout https://plugins.svn.wordpress.org/wordpress-importer/tags/0.6.3/ tests/phpunit/data/plugins/wordpress-importer
echo "Installing ImageMagick and Imagick..."
./tests/phpunit/bin/install-imagick.sh
fi
- |
if [[ "$WP_TRAVIS_OBJECT_CACHE" == "true" ]]; then
Expand Down Expand Up @@ -86,6 +89,7 @@ before_script:
- phpenv versions
- php --version
- php -m
- php --info | grep -i '\(^\w\+$\|version\)'
- npm --version
- node --version
- which phpunit
Expand All @@ -94,6 +98,7 @@ before_script:
- grunt --version
- git --version
- svn --version
- gs --version
- locale -a
script: grunt $WP_TRAVISCI
notifications:
Expand Down
6 changes: 0 additions & 6 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@
<testsuite>
<directory suffix=".php">tests/phpunit/tests</directory>
<exclude>tests/phpunit/tests/actions/closures.php</exclude>
<exclude>tests/phpunit/tests/image/editor.php</exclude>
<exclude>tests/phpunit/tests/image/editor_gd.php</exclude>
<exclude>tests/phpunit/tests/image/editor_imagick.php</exclude>
<exclude>tests/phpunit/tests/oembed/headers.php</exclude>
<file phpVersion="5.3.0">tests/phpunit/tests/actions/closures.php</file>
<file phpVersion="5.3.0">tests/phpunit/tests/image/editor.php</file>
<file phpVersion="5.3.0">tests/phpunit/tests/image/editor_gd.php</file>
<file phpVersion="5.3.0">tests/phpunit/tests/image/editor_imagick.php</file>
<file phpVersion="5.3.0">tests/phpunit/tests/oembed/headers.php</file>
</testsuite>
</testsuites>
Expand Down
49 changes: 49 additions & 0 deletions tests/phpunit/bin/install-imagick.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash

set -ex

# ImageMagick/Imagick versions to use
IMAGEMAGICK_VERSION='6.7.0-10'
IMAGICK_VERSION='3.4.3'

if [[ $TRAVIS_PHP_VERSION == 7.1 ]]; then
IMAGEMAGICK_VERSION='6.9.7-10'
elif [[ $TRAVIS_PHP_VERSION == 7.0 ]]; then
IMAGEMAGICK_VERSION='6.9.6-8'
elif [[ $TRAVIS_PHP_VERSION == 5.6 ]]; then
IMAGEMAGICK_VERSION='6.9.5-10'
elif [[ $TRAVIS_PHP_VERSION == 5.5 ]]; then
IMAGEMAGICK_VERSION='6.8.8-10'
elif [[ $TRAVIS_PHP_VERSION == 5.4 ]]; then
IMAGEMAGICK_VERSION='6.7.9-10'
elif [[ $TRAVIS_PHP_VERSION == 5.3 ]]; then
IMAGEMAGICK_VERSION='6.6.9-10'
elif [[ $TRAVIS_PHP_VERSION == 5.2 ]]; then
IMAGEMAGICK_VERSION='6.5.4-10'
IMAGICK_VERSION='3.1.0'
fi

install_imagemagick() {
curl -O "https://www.imagemagick.org/download/releases/ImageMagick-$IMAGEMAGICK_VERSION.tar.xz" -f
tar xf "ImageMagick-$IMAGEMAGICK_VERSION.tar.xz"
rm "ImageMagick-$IMAGEMAGICK_VERSION.tar.xz"
cd "ImageMagick-$IMAGEMAGICK_VERSION"

./configure --prefix="$HOME/opt/$TRAVIS_PHP_VERSION" --with-perl=no
make
make install

# Don't need doc - saves around 24M.
if [[ -d "$HOME/opt/$TRAVIS_PHP_VERSION/share/doc" ]]; then rm -rf "$HOME/opt/$TRAVIS_PHP_VERSION/share/doc"; fi

cd "$TRAVIS_BUILD_DIR"
}

# Install ImageMagick if the current version isn't up to date
PATH="$HOME/opt/$TRAVIS_PHP_VERSION/bin:$PATH" identify -version | grep "$IMAGEMAGICK_VERSION" || install_imagemagick

# Debugging
ls "$HOME/opt/$TRAVIS_PHP_VERSION"

# Install Imagick for PHP
echo "$HOME/opt/$TRAVIS_PHP_VERSION" | pecl install -f "imagick-$IMAGICK_VERSION"
6 changes: 0 additions & 6 deletions tests/phpunit/multisite.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@
<testsuite>
<directory suffix=".php">tests</directory>
<exclude>tests/phpunit/tests/actions/closures.php</exclude>
<exclude>tests/phpunit/tests/image/editor.php</exclude>
<exclude>tests/phpunit/tests/image/editor_gd.php</exclude>
<exclude>tests/phpunit/tests/image/editor_imagick.php</exclude>
<file phpVersion="5.3.0">tests/phpunit/tests/actions/closures.php</file>
<file phpVersion="5.3.0">tests/phpunit/tests/image/editor.php</file>
<file phpVersion="5.3.0">tests/phpunit/tests/image/editor_gd.php</file>
<file phpVersion="5.3.0">tests/phpunit/tests/image/editor_imagick.php</file>
</testsuite>
</testsuites>
<groups>
Expand Down
9 changes: 9 additions & 0 deletions tests/phpunit/tests/image/editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ public function test_set_quality() {
* @ticket 6821
*/
public function test_generate_filename() {
if ( version_compare( PHP_VERSION, '5.3', '<' ) ) {
$this->markTestSkipped( 'This test requires PHP >= 5.3' );
}

// Get an editor
$editor = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' );
Expand Down Expand Up @@ -142,6 +145,9 @@ public function test_generate_filename() {
* @ticket 6821
*/
public function test_get_size() {
if ( version_compare( PHP_VERSION, '5.3', '<' ) ) {
$this->markTestSkipped( 'This test requires PHP >= 5.3' );
}

$editor = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' );

Expand All @@ -165,6 +171,9 @@ public function test_get_size() {
* @ticket 6821
*/
public function test_get_suffix() {
if ( version_compare( PHP_VERSION, '5.3', '<' ) ) {
$this->markTestSkipped( 'This test requires PHP >= 5.3' );
}
$editor = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' );

// Size should be false by default
Expand Down
6 changes: 6 additions & 0 deletions tests/phpunit/tests/image/editor_gd.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,9 @@ public function test_crop() {
* Test rotating an image 180 deg
*/
public function test_rotate() {
if ( version_compare( PHP_VERSION, '5.3', '<' ) ) {
$this->markTestSkipped( 'This test requires PHP >= 5.3' );
}
$file = DIR_TESTDATA . '/images/gradient-square.jpg';

$gd_image_editor = new WP_Image_Editor_GD( $file );
Expand All @@ -446,6 +449,9 @@ public function test_rotate() {
* Test flipping an image
*/
public function test_flip() {
if ( version_compare( PHP_VERSION, '5.3', '<' ) ) {
$this->markTestSkipped( 'This test requires PHP >= 5.3' );
}
$file = DIR_TESTDATA . '/images/gradient-square.jpg';

$gd_image_editor = new WP_Image_Editor_GD( $file );
Expand Down
12 changes: 12 additions & 0 deletions tests/phpunit/tests/image/editor_imagick.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,9 @@ public function test_crop() {
* Test rotating an image 180 deg
*/
public function test_rotate() {
if ( version_compare( PHP_VERSION, '5.3', '<' ) ) {
$this->markTestSkipped( 'This test requires PHP >= 5.3' );
}
$file = DIR_TESTDATA . '/images/gradient-square.jpg';

$imagick_image_editor = new WP_Image_Editor_Imagick( $file );
Expand All @@ -439,6 +442,9 @@ public function test_rotate() {
* Test flipping an image
*/
public function test_flip() {
if ( version_compare( PHP_VERSION, '5.3', '<' ) ) {
$this->markTestSkipped( 'This test requires PHP >= 5.3' );
}
$file = DIR_TESTDATA . '/images/gradient-square.jpg';

$imagick_image_editor = new WP_Image_Editor_Imagick( $file );
Expand Down Expand Up @@ -513,6 +519,12 @@ public function test_image_preserves_alpha() {
* @ticket 30596
*/
public function test_image_preserves_alpha_on_rotate() {
// Need ImageMagick version >= 6.7.0-10, see #40537.
$imagick_version = Imagick::getVersion();
if ( preg_match( '/[0-9]+\.[0-9]+\.[0-9]+-[0-9]+/', $imagick_version['versionString'], $matches ) && version_compare( $matches[0], '6.7.0-10', '<' ) ) {
$this->markTestSkipped( 'This test requires ImageMagick >= 6.7.0-10' );
}

$file = DIR_TESTDATA . '/images/transparent.png';

$pre_rotate_editor = new Imagick( $file );
Expand Down