diff --git a/tests/unit/ColorsTest.php b/tests/unit/ColorsTest.php index 067c43d..68bc7b2 100644 --- a/tests/unit/ColorsTest.php +++ b/tests/unit/ColorsTest.php @@ -5,7 +5,6 @@ use BaconQrCode\Renderer\Color\Rgb; use Da\QrCode\Contracts\ColorsInterface; use Da\QrCode\Enums\Gradient; -use Da\QrCode\Factory\LaravelQrCodeFactory; use Da\QrCode\QrCode; use Da\QrCode\StyleManager; use Da\QrCode\Writer\EpsWriter; @@ -116,63 +115,6 @@ public function testGradientColors() ); } - public function testFactoryCreateGradientQrCode() - { - $foreground = [ - 'r' => 255, - 'g' => 0, - 'b' => 0, - ]; - $foreground2 = [ - 'r' => 0, - 'g' => 0, - 'b' => 255, - 'a' => 30, - ]; - - $qrCode = LaravelQrCodeFactory::make( - '2am. Technologies', - null, - $foreground, - null, - null, - null, - $foreground2 - ) - ->writeString(); - - $uri = file_get_contents(codecept_data_dir('blade/qrcode-gradient.png')); - - $this->assertEquals( - $this->normalizeString($qrCode), - $this->normalizeString($uri) - ); - - $qrCodeRadial = LaravelQrCodeFactory::make( - '2am. Technologies', - null, - $foreground, - null, - null, - null, - $foreground2, - null, - null, - null, - null, - null, - Gradient::GRADIENT_RADIAL - ) - ->writeString(); - - $uri = file_get_contents(codecept_data_dir('blade/qrcode-gradient-radial.png')); - - $this->assertEquals( - $this->normalizeString($qrCodeRadial), - $this->normalizeString($uri) - ); - } - public function testInvalidForegroundColorShouldThrowException() { $this->expectException(\Exception::class); diff --git a/tests/unit/LaravelQrCodeFactoryTest.php b/tests/unit/LaravelQrCodeFactoryTest.php index de420ff..cb8135b 100644 --- a/tests/unit/LaravelQrCodeFactoryTest.php +++ b/tests/unit/LaravelQrCodeFactoryTest.php @@ -31,7 +31,62 @@ public function testInvalidQrCodeFormatInvalidClass() LaravelQrCodeFactory::make('2am. Technologies', PngWriter::class); } + public function testCreateGradientQrCode() + { + $foreground = [ + 'r' => 255, + 'g' => 0, + 'b' => 0, + ]; + $foreground2 = [ + 'r' => 0, + 'g' => 0, + 'b' => 255, + 'a' => 30, + ]; + + $qrCode = LaravelQrCodeFactory::make( + '2am. Technologies', + null, + $foreground, + null, + null, + null, + $foreground2 + ) + ->writeString(); + file_put_contents(codecept_data_dir('blade/qrcode-gradient.png'), $qrCode); + $uri = file_get_contents(codecept_data_dir('blade/qrcode-gradient.png')); + + $this->assertEquals( + $this->normalizeString($qrCode), + $this->normalizeString($uri) + ); + $qrCodeRadial = LaravelQrCodeFactory::make( + '2am. Technologies', + null, + $foreground, + null, + null, + null, + $foreground2, + null, + null, + null, + null, + null, + Gradient::GRADIENT_RADIAL + ) + ->writeString(); + file_put_contents(codecept_data_dir('blade/qrcode-gradient-radial.png'), $qrCodeRadial); + $uri = file_get_contents(codecept_data_dir('blade/qrcode-gradient-radial.png')); + + $this->assertEquals( + $this->normalizeString($qrCodeRadial), + $this->normalizeString($uri) + ); + } protected function normalizeString($string) {