Skip to content

Commit

Permalink
PHP 5.5+ to restore broken tests
Browse files Browse the repository at this point in the history
This restore broken tests by raising the minimum version to PHP 5.5,
and testing on Windows with more recent PHP versions.

Fixes #780
Fixes #781
Fixes #783
Fixes #784
Fixes #785
Fixes #786
Fixes #788
  • Loading branch information
PowerKiKi committed Feb 19, 2022
1 parent dcbf6c5 commit 9e0ccc0
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 114 deletions.
53 changes: 2 additions & 51 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,57 +21,8 @@ env:
IMAGINE_TEST_WEBSERVERURL: http://localhost:8013
# Uncomment the following line to save test files as artifacts
#IMAGINE_TEST_KEEP_TEMPFILES: yes

jobs:
ubuntu:
name: PHP ${{ matrix.php-version }} - ${{ matrix.extensions }} (Ubuntu)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version:
- "5.3"
- "5.4"
extensions:
- gd,imagick
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: exif,${{ matrix.extensions }}
tools: composer:v2
coverage: none
- name: Inspect environment
id: inspect
run: |
EXCLUDED_GROUPS=always-skipped
for DRIVER in $ALL_DRIVERS; do
echo "### CHECKING $DRIVER"
if ! php --ri $DRIVER; then
EXCLUDED_GROUPS="$EXCLUDED_GROUPS,$DRIVER"
fi
echo ''
done
echo "::set-output name=excluded-groups::$EXCLUDED_GROUPS"
- name: Checkout
uses: actions/checkout@v2
- name: Install composer dependencies
run: composer update --ansi --no-interaction
- name: Start test web server
uses: Eun/http-server-action@v1
with:
directory: ${{ github.workspace }}/tests
port: 8013
- name: PHPUnit
run: composer run test --ansi --no-interaction -- --exclude-group "${{ steps.inspect.outputs.excluded-groups }}" --stop-on-error --stop-on-failure
- name: Save tests temporary files
if: always() && env.IMAGINE_TEST_KEEP_TEMPFILES == 'yes'
uses: actions/upload-artifact@v2
with:
name: ubuntu-${{ matrix.php-version }}-${{ matrix.extensions }}
path: tests/tmp/
retention-days: 1

windows:
name: PHP ${{ matrix.php-version }} - ${{ matrix.extensions }} (Windows)
Expand All @@ -80,8 +31,8 @@ jobs:
fail-fast: false
matrix:
php-version:
- "5.6"
- "7.4"
- "8.1"
extensions:
- gd,imagick
steps:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}
],
"require": {
"php": ">=5.3.2"
"php": ">=5.5"
},
"require-dev": {
"phpunit/phpunit": "^4.8 || ^5.7 || ^6.5 || ^7.5 || ^8.4 || ^9.3"
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def get_imagine_copyright():
html_title = 'Imagine, image manipulations reloaded'

# A shorter title for the navigation bar. Default is the same as html_title.
html_short_title = 'Imagine for PHP 5.3'
html_short_title = 'Imagine'

# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
Expand Down
4 changes: 2 additions & 2 deletions src/Driver/AbstractInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ abstract protected function checkFeature($feature);
*/
public function checkVersionIsSupported()
{
if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 50300) {
throw new NotSupportedException('Imagine requires PHP 5.3 or later');
if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 50500) {
throw new NotSupportedException('Imagine requires PHP 5.5 or later');
}
}

Expand Down
1 change: 1 addition & 0 deletions tests/tests/Draw/AbstractDrawerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Imagine\Driver\InfoProvider;
use Imagine\Exception\NotSupportedException;
use Imagine\Image\Box;
use Imagine\Image\Format;
use Imagine\Image\Palette\RGB;
use Imagine\Image\Point;
use Imagine\Image\Point\Center;
Expand Down
4 changes: 4 additions & 0 deletions tests/tests/Image/AbstractImageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1144,6 +1144,10 @@ function (array $case) use ($driverInfo) {
*/
public function testSaveCompressionQuality($format, array $smallSizeOptions, array $bigSizeOptions)
{
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' && $format === Format::ID_HEIC) {
$this->markTestSkipped('Cannot test HEIC on Windows because of bug https://github.com/ImageMagick/ImageMagick/issues/1648');
}

$filenameSmall = $this->getTemporaryFilename('small.' . $format);
$filenameBig = $this->getTemporaryFilename('big.' . $format);
$image = $this->getImagine()->open(IMAGINE_TEST_FIXTURESFOLDER . '/xparent.gif');
Expand Down
59 changes: 0 additions & 59 deletions tests/tests/Imagick/ImageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,65 +73,9 @@ protected function getSamplingFactors(ImageInterface $image)
*/
public function testUsePalette($from, $to, $color)
{
if ($from === 'Imagine\\Image\\Palette\\Grayscale' && $to === 'Imagine\\Image\\Palette\\RGB') {
$this->markTestSkipped('Temporarily skipped - see https://github.com/php-imagine/Imagine/issues/780');
}
if ($from === 'Imagine\\Image\\Palette\\Grayscale' && $to === 'Imagine\Image\Palette\CMYK') {
$this->markTestSkipped('Temporarily skipped - see https://github.com/php-imagine/Imagine/issues/780');
}
parent::testUsePalette($from, $to, $color);
}

/**
* {@inheritdoc}
*
* @see \Imagine\Test\Image\AbstractImageTest::testMask()
*/
public function testMask()
{
$this->markTestSkipped('Temporarily skipped - see https://github.com/php-imagine/Imagine/issues/781');
}

/**
* {@inheritdoc}
*
* @see \Imagine\Test\Image\AbstractImageTest::testGetColorAtGrayScale()
*/
public function testGetColorAtGrayScale()
{
$this->markTestSkipped('Temporarily skipped - see https://github.com/php-imagine/Imagine/issues/783');
}

/**
* {@inheritdoc}
*
* @see \Imagine\Test\Image\AbstractImageTest::testGetColorAtOpaque()
*/
public function testGetColorAtOpaque()
{
$this->markTestSkipped('Temporarily skipped - see https://github.com/php-imagine/Imagine/issues/784');
}

/**
* {@inheritdoc}
*
* @see \Imagine\Test\Image\AbstractImageTest::testStripGBRImageHasGoodColors()
*/
public function testStripGBRImageHasGoodColors()
{
$this->markTestSkipped('Temporarily skipped - see https://github.com/php-imagine/Imagine/issues/785');
}

/**
* {@inheritdoc}
*
* @see \Imagine\Test\Image\AbstractImageTest::testColorHistogram()
*/
public function testColorHistogram()
{
$this->markTestSkipped('Temporarily skipped - see https://github.com/php-imagine/Imagine/issues/785');
}

/**
* @dataProvider provideVariousSources
*
Expand All @@ -141,9 +85,6 @@ public function testColorHistogram()
*/
public function testResolutionOnSave($source)
{
if (substr($source, -4) === '.svg') {
$this->markTestSkipped('Temporarily skipped - see https://github.com/php-imagine/Imagine/issues/788');
}
parent::testResolutionOnSave($source);
}

Expand Down

0 comments on commit 9e0ccc0

Please sign in to comment.