From d690f909284ae4bb4dee7d00318104ee76720bfa Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Fri, 27 Nov 2020 16:46:57 +0100 Subject: [PATCH] Do not run image tests on php8 Signed-off-by: Roeland Jago Douma --- tests/lib/ImageTest.php | 69 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/tests/lib/ImageTest.php b/tests/lib/ImageTest.php index 5b83c4ac57..018d88c9d1 100644 --- a/tests/lib/ImageTest.php +++ b/tests/lib/ImageTest.php @@ -12,6 +12,7 @@ use OC; use OCP\IConfig; class ImageTest extends \Test\TestCase { + public static function tearDownAfterClass(): void { @unlink(OC::$SERVERROOT.'/tests/data/testimage2.png'); @unlink(OC::$SERVERROOT.'/tests/data/testimage2.jpg'); @@ -20,6 +21,10 @@ class ImageTest extends \Test\TestCase { } public function testConstructDestruct() { + if (PHP_MAJOR_VERSION > 7) { + $this->markTestSkipped('Only run on php7'); + } + $img = new \OC_Image(); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $this->assertInstanceOf('\OC_Image', $img); @@ -47,6 +52,10 @@ class ImageTest extends \Test\TestCase { } public function testValid() { + if (PHP_MAJOR_VERSION > 7) { + $this->markTestSkipped('Only run on php7'); + } + $img = new \OC_Image(); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $this->assertTrue($img->valid()); @@ -61,6 +70,10 @@ class ImageTest extends \Test\TestCase { } public function testMimeType() { + if (PHP_MAJOR_VERSION > 7) { + $this->markTestSkipped('Only run on php7'); + } + $img = new \OC_Image(); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $this->assertEquals('image/png', $img->mimeType()); @@ -78,6 +91,10 @@ class ImageTest extends \Test\TestCase { } public function testWidth() { + if (PHP_MAJOR_VERSION > 7) { + $this->markTestSkipped('Only run on php7'); + } + $img = new \OC_Image(); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $this->assertEquals(128, $img->width()); @@ -95,6 +112,10 @@ class ImageTest extends \Test\TestCase { } public function testHeight() { + if (PHP_MAJOR_VERSION > 7) { + $this->markTestSkipped('Only run on php7'); + } + $img = new \OC_Image(); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $this->assertEquals(128, $img->height()); @@ -112,6 +133,10 @@ class ImageTest extends \Test\TestCase { } public function testSave() { + if (PHP_MAJOR_VERSION > 7) { + $this->markTestSkipped('Only run on php7'); + } + $img = new \OC_Image(); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $img->resize(16); @@ -126,6 +151,10 @@ class ImageTest extends \Test\TestCase { } public function testData() { + if (PHP_MAJOR_VERSION > 7) { + $this->markTestSkipped('Only run on php7'); + } + $img = new \OC_Image(); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $raw = imagecreatefromstring(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.png')); @@ -160,6 +189,10 @@ class ImageTest extends \Test\TestCase { } public function testDataNoResource() { + if (PHP_MAJOR_VERSION > 7) { + $this->markTestSkipped('Only run on php7'); + } + $img = new \OC_Image(); $this->assertNull($img->data()); } @@ -168,6 +201,10 @@ class ImageTest extends \Test\TestCase { * @depends testData */ public function testToString() { + if (PHP_MAJOR_VERSION > 7) { + $this->markTestSkipped('Only run on php7'); + } + $img = new \OC_Image(); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $expected = base64_encode($img->data()); @@ -185,6 +222,10 @@ class ImageTest extends \Test\TestCase { } public function testResize() { + if (PHP_MAJOR_VERSION > 7) { + $this->markTestSkipped('Only run on php7'); + } + $img = new \OC_Image(); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $this->assertTrue($img->resize(32)); @@ -205,6 +246,10 @@ class ImageTest extends \Test\TestCase { } public function testPreciseResize() { + if (PHP_MAJOR_VERSION > 7) { + $this->markTestSkipped('Only run on php7'); + } + $img = new \OC_Image(); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $this->assertTrue($img->preciseResize(128, 512)); @@ -225,6 +270,10 @@ class ImageTest extends \Test\TestCase { } public function testCenterCrop() { + if (PHP_MAJOR_VERSION > 7) { + $this->markTestSkipped('Only run on php7'); + } + $img = new \OC_Image(); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $img->centerCrop(); @@ -245,6 +294,10 @@ class ImageTest extends \Test\TestCase { } public function testCrop() { + if (PHP_MAJOR_VERSION > 7) { + $this->markTestSkipped('Only run on php7'); + } + $img = new \OC_Image(); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $this->assertTrue($img->crop(0, 0, 50, 20)); @@ -280,6 +333,10 @@ class ImageTest extends \Test\TestCase { * @param int[] $expected */ public function testFitIn($filename, $asked, $expected) { + if (PHP_MAJOR_VERSION > 7) { + $this->markTestSkipped('Only run on php7'); + } + $img = new \OC_Image(); $img->loadFromFile(OC::$SERVERROOT . '/tests/data/' . $filename); $this->assertTrue($img->fitIn($asked[0], $asked[1])); @@ -303,6 +360,10 @@ class ImageTest extends \Test\TestCase { * @param string $filename */ public function testScaleDownToFitWhenSmallerAlready($filename) { + if (PHP_MAJOR_VERSION > 7) { + $this->markTestSkipped('Only run on php7'); + } + $img = new \OC_Image(); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/' . $filename); $currentWidth = $img->width(); @@ -336,6 +397,10 @@ class ImageTest extends \Test\TestCase { * @param int[] $expected */ public function testScaleDownWhenBigger($filename, $asked, $expected) { + if (PHP_MAJOR_VERSION > 7) { + $this->markTestSkipped('Only run on php7'); + } + $img = new \OC_Image(); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/' . $filename); //$this->assertTrue($img->scaleDownToFit($asked[0], $asked[1])); @@ -356,6 +421,10 @@ class ImageTest extends \Test\TestCase { * @dataProvider convertDataProvider */ public function testConvert($mimeType) { + if (PHP_MAJOR_VERSION > 7) { + $this->markTestSkipped('Only run on php7'); + } + $img = new \OC_Image(); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $tempFile = tempnam(sys_get_temp_dir(), 'img-test');