diff --git a/test/FactoryTest.php b/test/FactoryTest.php index 999aeef..050fcc4 100644 --- a/test/FactoryTest.php +++ b/test/FactoryTest.php @@ -9,19 +9,28 @@ namespace ZendTest\Barcode; +use DOMDocument; +use PHPUnit\Framework\TestCase; use ReflectionClass; use Zend\Barcode; use Zend\Barcode\Exception\InvalidArgumentException; -use Zend\Barcode\Renderer; use Zend\Barcode\Object\Code25; +use Zend\Barcode\Object\Code39; +use Zend\Barcode\Object\Error; +use Zend\Barcode\Renderer; +use Zend\Barcode\Renderer\Image; +use Zend\Barcode\Renderer\Pdf; use Zend\Config\Config; +use Zend\ServiceManager\Exception\ExceptionInterface; use Zend\ServiceManager\Exception\InvalidServiceException; -use ZendPdf as Pdf; +use Zend\ServiceManager\Exception\ServiceNotFoundException; +use Zend\Barcode\Renderer\RendererInterface; +use ZendPdf\PdfDocument; /** * @group Zend_Barcode */ -class FactoryTest extends \PHPUnit_Framework_TestCase +class FactoryTest extends TestCase { /** * Stores the original set timezone @@ -38,7 +47,7 @@ public function setUp() date_default_timezone_set('GMT'); // Reset plugin managers - $r = new ReflectionClass('Zend\Barcode\Barcode'); + $r = new ReflectionClass(Barcode\Barcode::class); $rObjectPlugins = $r->getProperty('objectPlugins'); $rObjectPlugins->setAccessible(true); @@ -58,8 +67,8 @@ public function testMinimalFactory() { $this->checkGDRequirement(); $renderer = Barcode\Barcode::factory('code39'); - $this->assertInstanceOf('Zend\Barcode\Renderer\Image', $renderer); - $this->assertInstanceOf('Zend\Barcode\Object\Code39', $renderer->getBarcode()); + $this->assertInstanceOf(Image::class, $renderer); + $this->assertInstanceOf(Code39::class, $renderer->getBarcode()); } /** @@ -68,8 +77,8 @@ public function testMinimalFactory() public function testMinimalFactoryWithRenderer() { $renderer = Barcode\Barcode::factory('code39', 'pdf'); - $this->assertInstanceOf('Zend\Barcode\Renderer\Pdf', $renderer); - $this->assertInstanceOf('Zend\Barcode\Object\Code39', $renderer->getBarcode()); + $this->assertInstanceOf(Pdf::class, $renderer); + $this->assertInstanceOf(Code39::class, $renderer->getBarcode()); } public function testFactoryWithOptions() @@ -85,20 +94,20 @@ public function testFactoryWithAutomaticExceptionRendering() $this->checkGDRequirement(); $options = ['barHeight' => - 1]; $renderer = Barcode\Barcode::factory('code39', 'image', $options); - $this->assertInstanceOf('Zend\Barcode\Renderer\Image', $renderer); - $this->assertInstanceOf('Zend\Barcode\Object\Error', $renderer->getBarcode()); + $this->assertInstanceOf(Image::class, $renderer); + $this->assertInstanceOf(Error::class, $renderer->getBarcode()); } public function testFactoryWithoutAutomaticObjectExceptionRendering() { - $this->setExpectedException('\Zend\ServiceManager\Exception\ExceptionInterface'); + $this->expectException(ExceptionInterface::class); $options = ['barHeight' => - 1]; $renderer = Barcode\Barcode::factory('code39', 'image', $options, [], false); } public function testFactoryWithoutAutomaticRendererExceptionRendering() { - $this->setExpectedException('\Zend\ServiceManager\Exception\ExceptionInterface'); + $this->expectException(ExceptionInterface::class); $this->checkGDRequirement(); $options = ['imageType' => 'my']; $renderer = Barcode\Barcode::factory('code39', 'image', [], $options, false); @@ -108,22 +117,27 @@ public function testFactoryWithoutAutomaticRendererExceptionRendering() public function testFactoryWithZendConfig() { $this->checkGDRequirement(); - $config = new Config(['barcode' => 'code39', - 'renderer' => 'image']); + $config = new Config([ + 'barcode' => 'code39', + 'renderer' => 'image', + ]); $renderer = Barcode\Barcode::factory($config); - $this->assertInstanceOf('Zend\Barcode\Renderer\Image', $renderer); - $this->assertInstanceOf('Zend\Barcode\Object\Code39', $renderer->getBarcode()); + $this->assertInstanceOf(Image::class, $renderer); + $this->assertInstanceOf(Code39::class, $renderer->getBarcode()); } public function testFactoryWithZendConfigAndObjectOptions() { $this->checkGDRequirement(); - $config = new Config(['barcode' => 'code25', - 'barcodeParams' => [ - 'barHeight' => 123]]); + $config = new Config([ + 'barcode' => 'code25', + 'barcodeParams' => [ + 'barHeight' => 123, + ], + ]); $renderer = Barcode\Barcode::factory($config); - $this->assertInstanceOf('Zend\Barcode\Renderer\Image', $renderer); - $this->assertInstanceOf('Zend\Barcode\Object\Code25', $renderer->getBarcode()); + $this->assertInstanceOf(Image::class, $renderer); + $this->assertInstanceOf(Code25::class, $renderer->getBarcode()); $this->assertEquals(123, $renderer->getBarcode()->getBarHeight()); } @@ -134,8 +148,8 @@ public function testFactoryWithZendConfigAndRendererOptions() 'rendererParams' => [ 'imageType' => 'gif']]); $renderer = Barcode\Barcode::factory($config); - $this->assertInstanceOf('Zend\Barcode\Renderer\Image', $renderer); - $this->assertInstanceOf('Zend\Barcode\Object\Code25', $renderer->getBarcode()); + $this->assertInstanceOf(Image::class, $renderer); + $this->assertInstanceOf(Code25::class, $renderer->getBarcode()); $this->assertSame('gif', $renderer->getImageType()); } @@ -143,8 +157,8 @@ public function testFactoryWithoutBarcodeWithAutomaticExceptionRender() { $this->checkGDRequirement(); $renderer = Barcode\Barcode::factory(null); - $this->assertInstanceOf('Zend\Barcode\Renderer\Image', $renderer); - $this->assertInstanceOf('Zend\Barcode\Object\Error', $renderer->getBarcode()); + $this->assertInstanceOf(Image::class, $renderer); + $this->assertInstanceOf(Error::class, $renderer->getBarcode()); } public function testFactoryWithoutBarcodeWithAutomaticExceptionRenderWithZendConfig() @@ -152,8 +166,8 @@ public function testFactoryWithoutBarcodeWithAutomaticExceptionRenderWithZendCon $this->checkGDRequirement(); $config = new Config(['barcode' => null]); $renderer = Barcode\Barcode::factory($config); - $this->assertInstanceOf('Zend\Barcode\Renderer\Image', $renderer); - $this->assertInstanceOf('Zend\Barcode\Object\Error', $renderer->getBarcode()); + $this->assertInstanceOf(Image::class, $renderer); + $this->assertInstanceOf(Error::class, $renderer->getBarcode()); } public function testFactoryWithExistingBarcodeObject() @@ -174,7 +188,7 @@ public function testBarcodeObjectFactoryWithExistingBarcodeObject() public function testBarcodeObjectFactoryWithBarcodeAsString() { $barcode = Barcode\Barcode::makeBarcode('code25'); - $this->assertInstanceOf('Zend\Barcode\Object\Code25', $barcode); + $this->assertInstanceOf(Code25::class, $barcode); // ensure makeBarcode creates unique instances $this->assertNotSame($barcode, Barcode\Barcode::makeBarcode('code25')); @@ -183,7 +197,7 @@ public function testBarcodeObjectFactoryWithBarcodeAsString() public function testBarcodeObjectFactoryWithBarcodeAsStringAndConfigAsArray() { $barcode = Barcode\Barcode::makeBarcode('code25', ['barHeight' => 123]); - $this->assertInstanceOf('Zend\Barcode\Object\Code25', $barcode); + $this->assertInstanceOf(Code25::class, $barcode); $this->assertSame(123, $barcode->getBarHeight()); } @@ -191,47 +205,50 @@ public function testBarcodeObjectFactoryWithBarcodeAsStringAndConfigAsZendConfig { $config = new Config(['barHeight' => 123]); $barcode = Barcode\Barcode::makeBarcode('code25', $config); - $this->assertInstanceOf('Zend\Barcode\Object\Code25', $barcode); + $this->assertInstanceOf(Code25::class, $barcode); $this->assertSame(123, $barcode->getBarHeight()); } public function testBarcodeObjectFactoryWithBarcodeAsZendConfig() { - $config = new Config(['barcode' => 'code25', - 'barcodeParams' => [ - 'barHeight' => 123]]); + $config = new Config([ + 'barcode' => 'code25', + 'barcodeParams' => [ + 'barHeight' => 123, + ], + ]); $barcode = Barcode\Barcode::makeBarcode($config); - $this->assertInstanceOf('Zend\Barcode\Object\Code25', $barcode); + $this->assertInstanceOf(Code25::class, $barcode); $this->assertSame(123, $barcode->getBarHeight()); } public function testBarcodeObjectFactoryWithBarcodeAsZendConfigButNoBarcodeParameter() { - $this->setExpectedException('\Zend\Barcode\Exception\ExceptionInterface'); + $this->expectException(\Zend\Barcode\Exception\ExceptionInterface::class); $config = new Config(['barcodeParams' => ['barHeight' => 123] ]); $barcode = Barcode\Barcode::makeBarcode($config); } public function testBarcodeObjectFactoryWithBarcodeAsZendConfigAndBadBarcodeParameters() { - $this->setExpectedException('\Zend\Barcode\Exception\ExceptionInterface'); + $this->expectException(\Zend\Barcode\Exception\ExceptionInterface::class); $barcode = Barcode\Barcode::makeBarcode('code25', null); } public function testBarcodeObjectFactoryWithNamespace() { $plugins = Barcode\Barcode::getObjectPluginManager(); - $plugins->setInvokableClass('barcodeNamespace', 'ZendTest\Barcode\Object\TestAsset\BarcodeNamespace'); + $plugins->setInvokableClass('barcodeNamespace', Object\TestAsset\BarcodeNamespace::class); $barcode = Barcode\Barcode::makeBarcode('barcodeNamespace'); - $this->assertInstanceOf('ZendTest\Barcode\Object\TestAsset\BarcodeNamespace', $barcode); + $this->assertInstanceOf(Object\TestAsset\BarcodeNamespace::class, $barcode); } public function testBarcodeObjectFactoryWithNamespaceExtendStandardLibray() { $plugins = Barcode\Barcode::getObjectPluginManager(); - $plugins->setInvokableClass('error', 'ZendTest\Barcode\Object\TestAsset\Error'); + $plugins->setInvokableClass('error', \ZendTest\Barcode\Object\TestAsset\Error::class); $barcode = Barcode\Barcode::makeBarcode('error'); - $this->assertInstanceOf('ZendTest\Barcode\Object\TestAsset\Error', $barcode); + $this->assertInstanceOf(\ZendTest\Barcode\Object\TestAsset\Error::class, $barcode); } public function testBarcodeObjectFactoryWithNamespaceButWithoutExtendingObjectAbstract() @@ -239,7 +256,7 @@ public function testBarcodeObjectFactoryWithNamespaceButWithoutExtendingObjectAb $plugins = Barcode\Barcode::getObjectPluginManager(); $plugins->setInvokableClass( 'barcodeNamespaceWithoutExtendingObjectAbstract', - 'ZendTest\Barcode\Object\TestAsset\BarcodeNamespaceWithoutExtendingObjectAbstract' + Object\TestAsset\BarcodeNamespaceWithoutExtendingObjectAbstract::class ); try { @@ -256,7 +273,7 @@ public function testBarcodeObjectFactoryWithNamespaceButWithoutExtendingObjectAb public function testBarcodeObjectFactoryWithUnexistentBarcode() { - $this->setExpectedException('Zend\ServiceManager\Exception\ServiceNotFoundException'); + $this->expectException(ServiceNotFoundException::class); $barcode = Barcode\Barcode::makeBarcode('zf123', []); } @@ -272,7 +289,7 @@ public function testBarcodeRendererFactoryWithBarcodeAsString() { $this->checkGDRequirement(); $renderer = Barcode\Barcode::makeRenderer('image'); - $this->assertInstanceOf('Zend\Barcode\Renderer\Image', $renderer); + $this->assertInstanceOf(Image::class, $renderer); // ensure unique instance is created $this->assertNotSame($renderer, Barcode\Barcode::makeRenderer('image')); @@ -283,7 +300,7 @@ public function testBarcodeRendererFactoryWithBarcodeAsStringAndConfigAsArray() $this->checkGDRequirement(); $renderer = Barcode\Barcode::makeRenderer('image', ['imageType' => 'gif']); - $this->assertInstanceOf('Zend\Barcode\Renderer\Image', $renderer); + $this->assertInstanceOf(Image::class, $renderer); $this->assertSame('gif', $renderer->getImageType()); } @@ -292,30 +309,32 @@ public function testBarcodeRendererFactoryWithBarcodeAsStringAndConfigAsZendConf $this->checkGDRequirement(); $config = new Config(['imageType' => 'gif']); $renderer = Barcode\Barcode::makeRenderer('image', $config); - $this->assertInstanceOf('Zend\Barcode\Renderer\Image', $renderer); + $this->assertInstanceOf(Image::class, $renderer); $this->assertSame('gif', $renderer->getimageType()); } public function testBarcodeRendererFactoryWithBarcodeAsZendConfig() { $this->checkGDRequirement(); - $config = new Config(['renderer' => 'image', - 'rendererParams' => ['imageType' => 'gif']]); + $config = new Config([ + 'renderer' => 'image', + 'rendererParams' => ['imageType' => 'gif'], + ]); $renderer = Barcode\Barcode::makeRenderer($config); - $this->assertInstanceOf('Zend\Barcode\Renderer\Image', $renderer); + $this->assertInstanceOf(Image::class, $renderer); $this->assertSame('gif', $renderer->getimageType()); } public function testBarcodeRendererFactoryWithBarcodeAsZendConfigButNoBarcodeParameter() { - $this->setExpectedException('\Zend\Barcode\Exception\ExceptionInterface'); + $this->expectException(\Zend\Barcode\Exception\ExceptionInterface::class); $config = new Config(['rendererParams' => ['imageType' => 'gif'] ]); $renderer = Barcode\Barcode::makeRenderer($config); } public function testBarcodeRendererFactoryWithBarcodeAsZendConfigAndBadBarcodeParameters() { - $this->setExpectedException('\Zend\Barcode\Exception\ExceptionInterface'); + $this->expectException(\Zend\Barcode\Exception\ExceptionInterface::class); $renderer = Barcode\Barcode::makeRenderer('image', null); } @@ -325,7 +344,7 @@ public function testBarcodeRendererFactoryWithNamespace() $plugins = Barcode\Barcode::getRendererPluginManager(); $plugins->setInvokableClass('rendererNamespace', 'ZendTest\Barcode\Renderer\TestAsset\RendererNamespace'); $renderer = Barcode\Barcode::makeRenderer('rendererNamespace'); - $this->assertInstanceOf('Zend\Barcode\Renderer\RendererInterface', $renderer); + $this->assertInstanceOf(RendererInterface::class, $renderer); } public function testBarcodeFactoryWithNamespaceButWithoutExtendingRendererAbstract() @@ -350,7 +369,7 @@ public function testBarcodeFactoryWithNamespaceButWithoutExtendingRendererAbstra public function testBarcodeRendererFactoryWithUnexistentRenderer() { - $this->setExpectedException('\Zend\ServiceManager\Exception\ServiceNotFoundException'); + $this->expectException(ServiceNotFoundException::class); $renderer = Barcode\Barcode::makeRenderer('zend', []); } @@ -394,7 +413,7 @@ public function testProxyBarcodeRendererDrawAsPdfAutomaticallyRenderPdfIfExcepti Barcode\Barcode::setBarcodeFont(__DIR__ . '/Object/_fonts/Vera.ttf'); $resource = Barcode\Barcode::draw('code25', 'pdf'); - $this->assertInstanceOf('ZendPdf\PdfDocument', $resource); + $this->assertInstanceOf(PdfDocument::class, $resource); Barcode\Barcode::setBarcodeFont(''); } @@ -402,7 +421,7 @@ public function testProxyBarcodeRendererDrawAsSvg() { Barcode\Barcode::setBarcodeFont(__DIR__ . '/Object/_fonts/Vera.ttf'); $resource = Barcode\Barcode::draw('code25', 'svg', ['text' => '012345']); - $this->assertInstanceOf('DOMDocument', $resource); + $this->assertInstanceOf(DOMDocument::class, $resource); Barcode\Barcode::setBarcodeFont(''); } @@ -410,7 +429,7 @@ public function testProxyBarcodeRendererDrawAsSvgAutomaticallyRenderSvgIfExcepti { Barcode\Barcode::setBarcodeFont(__DIR__ . '/Object/_fonts/Vera.ttf'); $resource = Barcode\Barcode::draw('code25', 'svg'); - $this->assertInstanceOf('DOMDocument', $resource); + $this->assertInstanceOf(DOMDocument::class, $resource); Barcode\Barcode::setBarcodeFont(''); } diff --git a/test/Object/Code25Test.php b/test/Object/Code25Test.php index 63bfd76..1a1cc5e 100644 --- a/test/Object/Code25Test.php +++ b/test/Object/Code25Test.php @@ -83,7 +83,7 @@ public function testBadTextAlwaysAllowed() public function testBadTextDetectedIfChecksumWished() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('a'); $this->object->setWithChecksum(true); $this->object->getText(); @@ -97,7 +97,7 @@ public function testCheckGoodParams() public function testCheckParamsWithLowRatio() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('0123456789'); $this->object->setBarThinWidth(21); $this->object->setBarThickWidth(40); @@ -106,7 +106,7 @@ public function testCheckParamsWithLowRatio() public function testCheckParamsWithHighRatio() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('0123456789'); $this->object->setBarThinWidth(20); $this->object->setBarThickWidth(61); diff --git a/test/Object/Code25interleavedTest.php b/test/Object/Code25interleavedTest.php index 3c3270d..106d15f 100644 --- a/test/Object/Code25interleavedTest.php +++ b/test/Object/Code25interleavedTest.php @@ -109,7 +109,7 @@ public function testBadTextAlwaysAllowed() public function testBadTextDetectedIfChecksumWished() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('a'); $this->object->setWithChecksum(true); $this->object->getText(); @@ -123,7 +123,7 @@ public function testCheckGoodParams() public function testCheckParamsWithLowRatio() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('0123456789'); $this->object->setBarThinWidth(21); $this->object->setBarThickWidth(40); @@ -132,7 +132,7 @@ public function testCheckParamsWithLowRatio() public function testCheckParamsWithHighRatio() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('0123456789'); $this->object->setBarThinWidth(20); $this->object->setBarThickWidth(61); diff --git a/test/Object/Code39Test.php b/test/Object/Code39Test.php index f369465..bd3f1b0 100644 --- a/test/Object/Code39Test.php +++ b/test/Object/Code39Test.php @@ -76,7 +76,7 @@ public function testBadTextAlwaysAllowed() public function testBadTextDetectedIfChecksumWished() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('&'); $this->object->setWithChecksum(true); $this->object->getText(); @@ -90,7 +90,7 @@ public function testCheckGoodParams() public function testCheckParamsWithLowRatio() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('TEST'); $this->object->setBarThinWidth(21); $this->object->setBarThickWidth(40); @@ -99,7 +99,7 @@ public function testCheckParamsWithLowRatio() public function testCheckParamsWithHighRatio() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('TEST'); $this->object->setBarThinWidth(20); $this->object->setBarThickWidth(61); diff --git a/test/Object/Ean13Test.php b/test/Object/Ean13Test.php index 51781d5..af38586 100644 --- a/test/Object/Ean13Test.php +++ b/test/Object/Ean13Test.php @@ -75,7 +75,7 @@ public function testSetTextWithChecksumNotDisplayed() public function testBadTextDetectedIfChecksumWished() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('a'); $this->object->setWithChecksum(true); $this->object->getText(); diff --git a/test/Object/Ean8Test.php b/test/Object/Ean8Test.php index 8394fa7..d41b080 100644 --- a/test/Object/Ean8Test.php +++ b/test/Object/Ean8Test.php @@ -75,7 +75,7 @@ public function testSetTextWithChecksumNotDisplayed() public function testBadTextDetectedIfChecksumWished() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('a'); $this->object->setWithChecksum(true); $this->object->getText(); diff --git a/test/Object/IdentcodeTest.php b/test/Object/IdentcodeTest.php index caaa2e6..f2f122b 100644 --- a/test/Object/IdentcodeTest.php +++ b/test/Object/IdentcodeTest.php @@ -75,7 +75,7 @@ public function testSetTextWithChecksumNotDisplayed() public function testBadTextDetectedIfChecksumWished() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('a'); $this->object->setWithChecksum(true); $this->object->getText(); diff --git a/test/Object/Itf14Test.php b/test/Object/Itf14Test.php index 395d741..84497db 100644 --- a/test/Object/Itf14Test.php +++ b/test/Object/Itf14Test.php @@ -75,7 +75,7 @@ public function testSetTextWithChecksumNotDisplayed() public function testBadTextDetectedIfChecksumWished() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('a'); $this->object->setWithChecksum(true); $this->object->getText(); @@ -89,7 +89,7 @@ public function testCheckGoodParams() public function testCheckParamsWithLowRatio() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('0000123456789'); $this->object->setBarThinWidth(21); $this->object->setBarThickWidth(40); @@ -98,7 +98,7 @@ public function testCheckParamsWithLowRatio() public function testCheckParamsWithHighRatio() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('0000123456789'); $this->object->setBarThinWidth(20); $this->object->setBarThickWidth(61); diff --git a/test/Object/LeitcodeTest.php b/test/Object/LeitcodeTest.php index d786560..881df1f 100644 --- a/test/Object/LeitcodeTest.php +++ b/test/Object/LeitcodeTest.php @@ -75,7 +75,7 @@ public function testSetTextWithChecksumNotDisplayed() public function testBadTextDetectedIfChecksumWished() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('a'); $this->object->setWithChecksum(true); $this->object->getText(); diff --git a/test/Object/PlanetTest.php b/test/Object/PlanetTest.php index d7eae2b..b8cb650 100644 --- a/test/Object/PlanetTest.php +++ b/test/Object/PlanetTest.php @@ -42,7 +42,7 @@ public function testSetText() public function testSetTextWithoutGoodNumberOfCharacters() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('1234'); $this->object->getText(); } @@ -75,7 +75,7 @@ public function testSetTextWithChecksumNotDisplayed() public function testBadTextDetectedIfChecksumWished() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('a'); $this->object->setWithChecksum(true); $this->object->getText(); diff --git a/test/Object/PostnetTest.php b/test/Object/PostnetTest.php index 92bc48c..a2c7259 100644 --- a/test/Object/PostnetTest.php +++ b/test/Object/PostnetTest.php @@ -42,7 +42,7 @@ public function testSetText() public function testSetTextWithoutGoodNumberOfCharacters() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('1234'); $this->object->getText(); } @@ -75,7 +75,7 @@ public function testSetTextWithChecksumNotDisplayed() public function testBadTextDetectedIfChecksumWished() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('a'); $this->object->setWithChecksum(true); $this->object->getText(); diff --git a/test/Object/RoyalmailTest.php b/test/Object/RoyalmailTest.php index bf8f773..05c16b9 100644 --- a/test/Object/RoyalmailTest.php +++ b/test/Object/RoyalmailTest.php @@ -69,7 +69,7 @@ public function testSetTextWithChecksumNotDisplayed() public function testBadTextDetectedIfChecksumWished() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('a'); $this->object->setWithChecksum(true); $this->object->getText(); diff --git a/test/Object/TestCommon.php b/test/Object/TestCommon.php index 7e99ed5..407ab10 100644 --- a/test/Object/TestCommon.php +++ b/test/Object/TestCommon.php @@ -9,10 +9,11 @@ namespace ZendTest\Barcode\Object; +use PHPUnit\Framework\TestCase; use Zend\Barcode; use Zend\Config; -abstract class TestCommon extends \PHPUnit_Framework_TestCase +abstract class TestCommon extends TestCase { /** * @var \Zend\Barcode\Object\AbstractObject @@ -102,7 +103,7 @@ public function testBarHeight() public function testNegativeBarHeight() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setBarHeight(- 1); } @@ -118,7 +119,7 @@ public function testBarThinWidth() public function testNegativeBarThinWidth() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setBarThinWidth(- 1); } @@ -134,7 +135,7 @@ public function testBarThickWidth() public function testNegativeBarThickWidth() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setBarThickWidth(- 1); } @@ -152,7 +153,7 @@ public function testFactor() public function testNegativeFactor() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setFactor(- 1); } @@ -166,13 +167,13 @@ public function testForeColor() public function testNegativeForeColor() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setForeColor(- 1); } public function testTooHighForeColor() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setForeColor(16777126); } @@ -186,13 +187,13 @@ public function testBackgroundColor() public function testNegativeBackgroundColor() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setBackgroundColor(- 1); } public function testTooHighBackgroundColor() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setBackgroundColor(16777126); } @@ -287,13 +288,13 @@ public function testSetFontAsNumberForGdImage() public function testSetLowFontAsNumberForGdImage() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setFont(0); } public function testSetHighFontAsNumberForGdImage() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setFont(6); } @@ -305,7 +306,7 @@ public function testSetFontAsString() public function testSetFontAsBoolean() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setFont(true); } @@ -316,7 +317,7 @@ public function testFontAsNumberWithoutGd() 'GD extension must not be loaded to run this test' ); } - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setFont(1); } @@ -340,7 +341,7 @@ public function testFontSizeWithoutEffectWithGdInternalFont() public function testStringFontSize() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setFontSize('22a'); } @@ -438,7 +439,7 @@ public function testAddTextWithDefaultColor() public function testCheckParamsFontWithOrientation() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('0'); $this->object->setFont(1); $this->object->setOrientation(45); diff --git a/test/Object/UpcaTest.php b/test/Object/UpcaTest.php index 07e28e2..e6bdde3 100644 --- a/test/Object/UpcaTest.php +++ b/test/Object/UpcaTest.php @@ -75,7 +75,7 @@ public function testSetTextWithChecksumNotDisplayed() public function testBadTextDetectedIfChecksumWished() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('a'); $this->object->setWithChecksum(true); $this->object->getText(); diff --git a/test/Object/UpceTest.php b/test/Object/UpceTest.php index e46cf2d..b65feb9 100644 --- a/test/Object/UpceTest.php +++ b/test/Object/UpceTest.php @@ -83,7 +83,7 @@ public function testSetTextWithChecksumNotDisplayed() public function testBadTextDetectedIfChecksumWished() { - $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('a'); $this->object->setWithChecksum(true); $this->object->getText(); diff --git a/test/ObjectPluginManagerCompatibilityTest.php b/test/ObjectPluginManagerCompatibilityTest.php index 1721296..bb1c7b6 100644 --- a/test/ObjectPluginManagerCompatibilityTest.php +++ b/test/ObjectPluginManagerCompatibilityTest.php @@ -9,7 +9,7 @@ namespace ZendTest\Barcode; -use PHPUnit_Framework_TestCase as TestCase; +use PHPUnit\Framework\TestCase; use Zend\Barcode\Exception\InvalidArgumentException; use Zend\Barcode\Object\AbstractObject; use Zend\Barcode\ObjectPluginManager; diff --git a/test/Renderer/ImageTest.php b/test/Renderer/ImageTest.php index bb7e0e3..8a2958e 100644 --- a/test/Renderer/ImageTest.php +++ b/test/Renderer/ImageTest.php @@ -44,7 +44,7 @@ public function testGoodImageResource() public function testObjectImageResource() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $imageResource = new \stdClass(); $this->renderer->setResource($imageResource); } @@ -60,7 +60,7 @@ public function testGoodHeight() public function testBadHeight() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $this->renderer->setHeight(- 1); } @@ -75,7 +75,7 @@ public function testGoodWidth() public function testBadWidth() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $this->renderer->setWidth(- 1); } @@ -94,7 +94,7 @@ public function testAllowedImageType() public function testNonAllowedImageType() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $this->renderer->setImageType('other'); } @@ -132,7 +132,7 @@ public function testGoodUserHeight() public function testBadUserHeightLessThanBarcodeHeight() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $barcode = new Code39(['text' => '0123456789']); $this->assertEquals(62, $barcode->getHeight()); $this->renderer->setBarcode($barcode); @@ -151,7 +151,7 @@ public function testGoodUserWidth() public function testBadUserWidthLessThanBarcodeWidth() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $barcode = new Code39(['text' => '0123456789']); $this->assertEquals(211, $barcode->getWidth()); $this->renderer->setBarcode($barcode); @@ -171,7 +171,7 @@ public function testGoodHeightOfUserResource() public function testBadHeightOfUserResource() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $barcode = new Code39(['text' => '0123456789']); $this->assertEquals(62, $barcode->getHeight()); $this->renderer->setBarcode($barcode); @@ -192,7 +192,7 @@ public function testGoodWidthOfUserResource() public function testBadWidthOfUserResource() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $barcode = new Code39(['text' => '0123456789']); $this->assertEquals(211, $barcode->getWidth()); $this->renderer->setBarcode($barcode); @@ -203,7 +203,7 @@ public function testBadWidthOfUserResource() public function testNoFontWithOrientation() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); Barcode\Barcode::setBarcodeFont(null); $barcode = new Code39(['text' => '0123456789']); $barcode->setOrientation(1); @@ -218,7 +218,7 @@ protected function getRendererWithWidth500AndHeight300() public function testRendererWithUnkownInstructionProvideByObject() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); parent::testRendererWithUnkownInstructionProvideByObject(); } diff --git a/test/Renderer/SvgTest.php b/test/Renderer/SvgTest.php index cb14ff6..240f7ad 100644 --- a/test/Renderer/SvgTest.php +++ b/test/Renderer/SvgTest.php @@ -75,7 +75,7 @@ public function testGoodHeight() public function testBadHeight() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $this->renderer->setHeight(-1); } @@ -90,7 +90,7 @@ public function testGoodWidth() public function testBadWidth() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $this->renderer->setWidth(-1); } diff --git a/test/Renderer/TestCommon.php b/test/Renderer/TestCommon.php index 06fc8a3..9b096e6 100644 --- a/test/Renderer/TestCommon.php +++ b/test/Renderer/TestCommon.php @@ -9,12 +9,13 @@ namespace ZendTest\Barcode\Renderer; -use ZendTest\Barcode\Object\TestAsset as TestAsset; +use PHPUnit\Framework\TestCase; +use ZendTest\Barcode\Object\TestAsset; use Zend\Barcode; use Zend\Barcode\Object\Code39; use Zend\Config; -abstract class TestCommon extends \PHPUnit_Framework_TestCase +abstract class TestCommon extends TestCase { /** * @var \Zend\Barcode\Renderer @@ -64,13 +65,13 @@ public function testGoodModuleSize() public function testModuleSizeAsString() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $this->renderer->setModuleSize('abc'); } public function testModuleSizeLessThan0() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $this->renderer->setModuleSize(-0.5); } @@ -95,7 +96,7 @@ public function testGoodHorizontalPosition() public function testBadHorizontalPosition() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $this->renderer->setHorizontalPosition('none'); } @@ -112,7 +113,7 @@ public function testGoodVerticalPosition() public function testBadVerticalPosition() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $this->renderer->setVerticalPosition('none'); } @@ -127,7 +128,7 @@ public function testGoodLeftOffset() public function testBadLeftOffset() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $this->renderer->setLeftOffset(- 1); } @@ -142,7 +143,7 @@ public function testGoodTopOffset() public function testBadTopOffset() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $this->renderer->setTopOffset(- 1); } @@ -183,7 +184,7 @@ public function testRendererNamespace() public function testRendererWithUnkownInstructionProvideByObject() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $object = new TestAsset\BarcodeTest(); $object->setText('test'); $object->addTestInstruction(['type' => 'unknown']); @@ -193,7 +194,7 @@ public function testRendererWithUnkownInstructionProvideByObject() public function testBarcodeObjectProvided() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); + $this->expectException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $this->renderer->draw(); } diff --git a/test/RendererPluginManagerCompatibilityTest.php b/test/RendererPluginManagerCompatibilityTest.php index 1e2e492..d142fbc 100644 --- a/test/RendererPluginManagerCompatibilityTest.php +++ b/test/RendererPluginManagerCompatibilityTest.php @@ -9,7 +9,7 @@ namespace ZendTest\Barcode; -use PHPUnit_Framework_TestCase as TestCase; +use PHPUnit\Framework\TestCase; use Zend\Barcode\Exception\InvalidArgumentException; use Zend\Barcode\Renderer\AbstractRenderer; use Zend\Barcode\RendererPluginManager;