diff options
Diffstat (limited to 'tests/lib/ImageTest.php')
-rw-r--r-- | tests/lib/ImageTest.php | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/tests/lib/ImageTest.php b/tests/lib/ImageTest.php index 5de5435335a..02181fffff9 100644 --- a/tests/lib/ImageTest.php +++ b/tests/lib/ImageTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -271,7 +272,7 @@ class ImageTest extends \Test\TestCase { $this->assertEquals(15, $img->height()); } - public static function sampleProvider() { + public static function sampleProvider(): array { return [ ['testimage.png', [200, 100], [100, 100]], ['testimage.jpg', [840, 840], [840, 525]], @@ -280,12 +281,12 @@ class ImageTest extends \Test\TestCase { } /** - * @dataProvider sampleProvider * * @param string $filename * @param int[] $asked * @param int[] $expected */ + #[\PHPUnit\Framework\Attributes\DataProvider('sampleProvider')] public function testFitIn($filename, $asked, $expected): void { $img = new Image(); $img->loadFromFile(OC::$SERVERROOT . '/tests/data/' . $filename); @@ -294,7 +295,7 @@ class ImageTest extends \Test\TestCase { $this->assertEquals($expected[1], $img->height()); } - public static function sampleFilenamesProvider() { + public static function sampleFilenamesProvider(): array { return [ ['testimage.png'], ['testimage.jpg'], @@ -305,10 +306,10 @@ class ImageTest extends \Test\TestCase { /** * Image should not be resized if it's already smaller than what is required * - * @dataProvider sampleFilenamesProvider * * @param string $filename */ + #[\PHPUnit\Framework\Attributes\DataProvider('sampleFilenamesProvider')] public function testScaleDownToFitWhenSmallerAlready($filename): void { $img = new Image(); $img->loadFromFile(OC::$SERVERROOT . '/tests/data/' . $filename); @@ -328,7 +329,7 @@ class ImageTest extends \Test\TestCase { ); } - public static function largeSampleProvider() { + public static function largeSampleProvider(): array { return [ ['testimage.png', [200, 100], [100, 100]], ['testimage.jpg', [840, 840], [840, 525]], @@ -336,12 +337,12 @@ class ImageTest extends \Test\TestCase { } /** - * @dataProvider largeSampleProvider * * @param string $filename * @param int[] $asked * @param int[] $expected */ + #[\PHPUnit\Framework\Attributes\DataProvider('largeSampleProvider')] public function testScaleDownWhenBigger($filename, $asked, $expected): void { $img = new Image(); $img->loadFromFile(OC::$SERVERROOT . '/tests/data/' . $filename); @@ -351,7 +352,7 @@ class ImageTest extends \Test\TestCase { $this->assertEquals($expected[1], $img->height()); } - public function convertDataProvider() { + public static function convertDataProvider(): array { return [ [ 'image/gif'], [ 'image/jpeg'], @@ -359,9 +360,7 @@ class ImageTest extends \Test\TestCase { ]; } - /** - * @dataProvider convertDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('convertDataProvider')] public function testConvert($mimeType): void { $img = new Image(); $img->loadFromFile(OC::$SERVERROOT . '/tests/data/testimage.png'); |