Do not run image tests on php8

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2020-11-27 16:46:57 +01:00
parent 1670eabdb3
commit d690f90928
No known key found for this signature in database
GPG Key ID: F941078878347C0C
1 changed files with 69 additions and 0 deletions

View File

@ -12,6 +12,7 @@ use OC;
use OCP\IConfig; use OCP\IConfig;
class ImageTest extends \Test\TestCase { class ImageTest extends \Test\TestCase {
public static function tearDownAfterClass(): void { public static function tearDownAfterClass(): void {
@unlink(OC::$SERVERROOT.'/tests/data/testimage2.png'); @unlink(OC::$SERVERROOT.'/tests/data/testimage2.png');
@unlink(OC::$SERVERROOT.'/tests/data/testimage2.jpg'); @unlink(OC::$SERVERROOT.'/tests/data/testimage2.jpg');
@ -20,6 +21,10 @@ class ImageTest extends \Test\TestCase {
} }
public function testConstructDestruct() { public function testConstructDestruct() {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}
$img = new \OC_Image(); $img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$this->assertInstanceOf('\OC_Image', $img); $this->assertInstanceOf('\OC_Image', $img);
@ -47,6 +52,10 @@ class ImageTest extends \Test\TestCase {
} }
public function testValid() { public function testValid() {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}
$img = new \OC_Image(); $img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$this->assertTrue($img->valid()); $this->assertTrue($img->valid());
@ -61,6 +70,10 @@ class ImageTest extends \Test\TestCase {
} }
public function testMimeType() { public function testMimeType() {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}
$img = new \OC_Image(); $img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$this->assertEquals('image/png', $img->mimeType()); $this->assertEquals('image/png', $img->mimeType());
@ -78,6 +91,10 @@ class ImageTest extends \Test\TestCase {
} }
public function testWidth() { public function testWidth() {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}
$img = new \OC_Image(); $img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$this->assertEquals(128, $img->width()); $this->assertEquals(128, $img->width());
@ -95,6 +112,10 @@ class ImageTest extends \Test\TestCase {
} }
public function testHeight() { public function testHeight() {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}
$img = new \OC_Image(); $img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$this->assertEquals(128, $img->height()); $this->assertEquals(128, $img->height());
@ -112,6 +133,10 @@ class ImageTest extends \Test\TestCase {
} }
public function testSave() { public function testSave() {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}
$img = new \OC_Image(); $img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$img->resize(16); $img->resize(16);
@ -126,6 +151,10 @@ class ImageTest extends \Test\TestCase {
} }
public function testData() { public function testData() {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}
$img = new \OC_Image(); $img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$raw = imagecreatefromstring(file_get_contents(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() { public function testDataNoResource() {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}
$img = new \OC_Image(); $img = new \OC_Image();
$this->assertNull($img->data()); $this->assertNull($img->data());
} }
@ -168,6 +201,10 @@ class ImageTest extends \Test\TestCase {
* @depends testData * @depends testData
*/ */
public function testToString() { public function testToString() {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}
$img = new \OC_Image(); $img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$expected = base64_encode($img->data()); $expected = base64_encode($img->data());
@ -185,6 +222,10 @@ class ImageTest extends \Test\TestCase {
} }
public function testResize() { public function testResize() {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}
$img = new \OC_Image(); $img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$this->assertTrue($img->resize(32)); $this->assertTrue($img->resize(32));
@ -205,6 +246,10 @@ class ImageTest extends \Test\TestCase {
} }
public function testPreciseResize() { public function testPreciseResize() {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}
$img = new \OC_Image(); $img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$this->assertTrue($img->preciseResize(128, 512)); $this->assertTrue($img->preciseResize(128, 512));
@ -225,6 +270,10 @@ class ImageTest extends \Test\TestCase {
} }
public function testCenterCrop() { public function testCenterCrop() {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}
$img = new \OC_Image(); $img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$img->centerCrop(); $img->centerCrop();
@ -245,6 +294,10 @@ class ImageTest extends \Test\TestCase {
} }
public function testCrop() { public function testCrop() {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}
$img = new \OC_Image(); $img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$this->assertTrue($img->crop(0, 0, 50, 20)); $this->assertTrue($img->crop(0, 0, 50, 20));
@ -280,6 +333,10 @@ class ImageTest extends \Test\TestCase {
* @param int[] $expected * @param int[] $expected
*/ */
public function testFitIn($filename, $asked, $expected) { public function testFitIn($filename, $asked, $expected) {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}
$img = new \OC_Image(); $img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT . '/tests/data/' . $filename); $img->loadFromFile(OC::$SERVERROOT . '/tests/data/' . $filename);
$this->assertTrue($img->fitIn($asked[0], $asked[1])); $this->assertTrue($img->fitIn($asked[0], $asked[1]));
@ -303,6 +360,10 @@ class ImageTest extends \Test\TestCase {
* @param string $filename * @param string $filename
*/ */
public function testScaleDownToFitWhenSmallerAlready($filename) { public function testScaleDownToFitWhenSmallerAlready($filename) {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}
$img = new \OC_Image(); $img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/' . $filename); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/' . $filename);
$currentWidth = $img->width(); $currentWidth = $img->width();
@ -336,6 +397,10 @@ class ImageTest extends \Test\TestCase {
* @param int[] $expected * @param int[] $expected
*/ */
public function testScaleDownWhenBigger($filename, $asked, $expected) { public function testScaleDownWhenBigger($filename, $asked, $expected) {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}
$img = new \OC_Image(); $img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/' . $filename); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/' . $filename);
//$this->assertTrue($img->scaleDownToFit($asked[0], $asked[1])); //$this->assertTrue($img->scaleDownToFit($asked[0], $asked[1]));
@ -356,6 +421,10 @@ class ImageTest extends \Test\TestCase {
* @dataProvider convertDataProvider * @dataProvider convertDataProvider
*/ */
public function testConvert($mimeType) { public function testConvert($mimeType) {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}
$img = new \OC_Image(); $img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png'); $img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$tempFile = tempnam(sys_get_temp_dir(), 'img-test'); $tempFile = tempnam(sys_get_temp_dir(), 'img-test');