diff --git a/tests/Output/QROutputTestAbstract.php b/tests/Output/QROutputTestAbstract.php index c41f979bb..fa93a6729 100644 --- a/tests/Output/QROutputTestAbstract.php +++ b/tests/Output/QROutputTestAbstract.php @@ -70,11 +70,6 @@ abstract class QROutputTestAbstract extends TestCase{ * Tests if an exception is thrown when trying to write a cache file to an invalid destination */ public function testSaveException():void{ - -# if(PHP_OS_FAMILY === 'Windows'){ -# $this::markTestSkipped('why does this fail on CI??'); -# } - $this->expectException(QRCodeOutputException::class); $this->expectExceptionMessage('Could not write data to cache file: /foo/bar.test'); diff --git a/tests/QRCodeReaderTest.php b/tests/QRCodeReaderTest.php index c0524da8a..4965d8599 100644 --- a/tests/QRCodeReaderTest.php +++ b/tests/QRCodeReaderTest.php @@ -46,6 +46,8 @@ class QRCodeReaderTest extends TestCase{ 'damaged' => ['damaged.png', 'https://smiley.codes/qrcode/'], // covers Binarizer::getHistogramBlackMatrix() 'smol' => ['smol.png', 'https://smiley.codes/qrcode/'], + 'tilted' => ['tilted.png', 'Hello world!'], // tilted 22° CCW + 'rotated' => ['rotated.png', 'Hello world!'], // rotated 90° CW ]; } @@ -55,7 +57,7 @@ class QRCodeReaderTest extends TestCase{ public function testReaderGD(string $img, string $expected):void{ $reader = new QRCodeReader(false); - self::assertSame($expected, (string)$reader->readFile(__DIR__.'/qrcodes/'.$img)); + $this::assertSame($expected, (string)$reader->readFile(__DIR__.'/qrcodes/'.$img)); } /** @@ -64,17 +66,17 @@ class QRCodeReaderTest extends TestCase{ public function testReaderImagick(string $img, string $expected):void{ if(!extension_loaded('imagick')){ - self::markTestSkipped('imagick not installed'); + $this::markTestSkipped('imagick not installed'); } $reader = new QRCodeReader(true); - self::assertSame($expected, (string)$reader->readFile(__DIR__.'/qrcodes/'.$img)); + $this::assertSame($expected, (string)$reader->readFile(__DIR__.'/qrcodes/'.$img)); } public function dataTestProvider():array{ $data = []; - $str = str_repeat(self::loremipsum, 5); + $str = str_repeat($this::loremipsum, 5); foreach(range(1, 40) as $v){ $version = new Version($v); @@ -82,7 +84,7 @@ class QRCodeReaderTest extends TestCase{ foreach(EccLevel::MODES as $ecc => $_){ $eccLevel = new EccLevel($ecc); - $data['version: '.$version->getVersionNumber().$eccLevel->__toString()] = [ + $data['version: '.$version.$eccLevel] = [ $version, $eccLevel, /** @phan-suppress-next-line PhanTypeMismatchArgumentNullableInternal */ @@ -103,20 +105,19 @@ class QRCodeReaderTest extends TestCase{ $options->eccLevel = $ecc->getLevel(); $options->version = $version->getVersionNumber(); $options->imageBase64 = false; - $options->scale = 1; // what's interesting is that a smaller scale seems to produce less errors??? - - $imagedata = (new QRCode($options))->render($expected); + $options->scale = 1; // what's interesting is that a smaller scale seems to produce fewer reader errors??? try{ - $result = (new QRCodeReader(true))->readBlob($imagedata); + $imagedata = (new QRCode($options))->render($expected); + $result = (new QRCodeReader(true))->readBlob($imagedata); } catch(Exception $e){ - self::markTestSkipped($version->getVersionNumber().$ecc->__toString().': '.$e->getMessage()); + $this::markTestSkipped($version.$ecc.': '.$e->getMessage()); } - self::assertSame($expected, $result->getText()); - self::assertSame($version->getVersionNumber(), $result->getVersion()->getVersionNumber()); - self::assertSame($ecc->getLevel(), $result->getEccLevel()->getLevel()); + $this::assertSame($expected, $result->getText()); + $this::assertSame($version->getVersionNumber(), $result->getVersion()->getVersionNumber()); + $this::assertSame($ecc->getLevel(), $result->getEccLevel()->getLevel()); } } diff --git a/tests/qrcodes/rotated.png b/tests/qrcodes/rotated.png new file mode 100644 index 000000000..194a3c22c Binary files /dev/null and b/tests/qrcodes/rotated.png differ diff --git a/tests/qrcodes/tilted.png b/tests/qrcodes/tilted.png new file mode 100644 index 000000000..a91834437 Binary files /dev/null and b/tests/qrcodes/tilted.png differ