diff --git a/.travis/run-tests.sh b/.travis/run-tests.sh new file mode 100755 index 0000000..11d98cd --- /dev/null +++ b/.travis/run-tests.sh @@ -0,0 +1,14 @@ +#!/bin/bash +travisdir=$(dirname $(readlink /proc/$$/fd/255)) +testdir="$travisdir/../tests" +testedcomponents=(`cat "$travisdir/tested-components"`) +result=0 + +for tested in "${testedcomponents[@]}" + do + echo "$tested:" + phpunit -c $testdir/phpunit.xml $testdir/$tested + let "result = $result || $?" +done + +exit $result \ No newline at end of file diff --git a/.travis/skipped-components b/.travis/skipped-components new file mode 100644 index 0000000..6847359 --- /dev/null +++ b/.travis/skipped-components @@ -0,0 +1,9 @@ +Zend/Amf +Zend/Barcode +Zend/Date +Zend/Feed +Zend/Queue +Zend/Service +Zend/Test +Zend/Translator +Zend/Wildfire diff --git a/.travis/tested-components b/.travis/tested-components new file mode 100644 index 0000000..330e5f1 --- /dev/null +++ b/.travis/tested-components @@ -0,0 +1,58 @@ +Zend/Acl +Zend/Authentication +Zend/Cache +Zend/Captcha +Zend/Cloud +Zend/Code +Zend/Config +Zend/Console +Zend/Crypt +Zend/Currency +Zend/Db +Zend/Di +Zend/Docbook +Zend/Dojo +Zend/Dom +Zend/EventManager +Zend/Feed/Reader +Zend/Feed/Writer +Zend/File +Zend/Filter +Zend/Form +Zend/GData +Zend/Http +Zend/InfoCard +Zend/Json +Zend/Ldap +Zend/Loader +Zend/Locale +Zend/Log +Zend/Mail +Zend/Markup +Zend/Measure +Zend/Memory +Zend/Mime +Zend/Module +Zend/Mvc +Zend/Navigation +Zend/OAuth +Zend/OpenId +Zend/Paginator +Zend/Pdf +Zend/ProgressBar +Zend/RegistryTest.php +Zend/Rest +Zend/Search +Zend/Serializer +Zend/Server +Zend/Session +Zend/Soap +Zend/Stdlib +Zend/Tag +Zend/Text +Zend/TimeSync +Zend/Uri +Zend/Validator +Zend/VersionTest.php +Zend/View +Zend/XmlRpc diff --git a/src/Barcode.php b/src/Barcode.php index e8af2c8..d83d0db 100644 --- a/src/Barcode.php +++ b/src/Barcode.php @@ -147,7 +147,7 @@ public static function factory($barcode, try { $barcode = self::makeBarcode($barcode, $barcodeConfig); $renderer = self::makeRenderer($renderer, $rendererConfig); - } catch (Exception $e) { + } catch (Exception\ExceptionInterface $e) { if ($automaticRenderError && !($e instanceof Exception\RendererCreationException)) { $barcode = self::makeBarcode('error', array( 'text' => $e->getMessage() )); $renderer = self::makeRenderer($renderer, array()); @@ -169,7 +169,7 @@ public static function factory($barcode, */ public static function makeBarcode($barcode, $barcodeConfig = array()) { - if ($barcode instanceof Object) { + if ($barcode instanceof Object\ObjectInterface) { return $barcode; } @@ -222,7 +222,7 @@ public static function makeBarcode($barcode, $barcodeConfig = array()) */ public static function makeRenderer($renderer = 'image', $rendererConfig = array()) { - if ($renderer instanceof Renderer) { + if ($renderer instanceof Renderer\RendererInterface) { return $renderer; } @@ -267,7 +267,7 @@ public static function makeRenderer($renderer = 'image', $rendererConfig = array /** * Proxy to renderer render() method * - * @param string | Object | array | Traversable $barcode + * @param string | Object\ObjectInterface | array | Traversable $barcode * @param string | Renderer $renderer * @param array | Traversable $barcodeConfig * @param array | Traversable $rendererConfig @@ -283,7 +283,7 @@ public static function render($barcode, /** * Proxy to renderer draw() method * - * @param string | Object | array | Traversable $barcode + * @param string | Object\ObjectInterface | array | Traversable $barcode * @param string | Renderer $renderer * @param array | Traversable $barcodeConfig * @param array | Traversable $rendererConfig diff --git a/src/Exception.php b/src/Exception/ExceptionInterface.php similarity index 92% rename from src/Exception.php rename to src/Exception/ExceptionInterface.php index 127984c..6c65349 100644 --- a/src/Exception.php +++ b/src/Exception/ExceptionInterface.php @@ -18,7 +18,7 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ -namespace Zend\Barcode; +namespace Zend\Barcode\Exception; /** * Exception for Zend_Barcode component. @@ -26,9 +26,10 @@ * @uses Zend\Exception * @category Zend * @package Zend_Barcode + * @subpackage Exception * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface Exception +interface ExceptionInterface { } diff --git a/src/Exception/InvalidArgumentException.php b/src/Exception/InvalidArgumentException.php index e87d7d4..07a22e0 100644 --- a/src/Exception/InvalidArgumentException.php +++ b/src/Exception/InvalidArgumentException.php @@ -21,8 +21,6 @@ namespace Zend\Barcode\Exception; -use Zend\Barcode\Exception; - /** * Exception for Zend_Barcode component. * @@ -33,6 +31,6 @@ */ class InvalidArgumentException extends \InvalidArgumentException - implements Exception + implements ExceptionInterface { } diff --git a/src/Exception/RendererCreationException.php b/src/Exception/RendererCreationException.php index 7477941..9bcb0d1 100644 --- a/src/Exception/RendererCreationException.php +++ b/src/Exception/RendererCreationException.php @@ -21,8 +21,6 @@ namespace Zend\Barcode\Exception; -use Zend\Barcode\Exception; - /** * Exception for Zend_Barcode component. * @@ -33,6 +31,6 @@ */ class RendererCreationException extends \InvalidArgumentException - implements Exception + implements ExceptionInterface { } diff --git a/src/Object/AbstractObject.php b/src/Object/AbstractObject.php index c184e1c..ecba756 100644 --- a/src/Object/AbstractObject.php +++ b/src/Object/AbstractObject.php @@ -23,7 +23,6 @@ use Traversable, Zend\Barcode, - Zend\Barcode\Object\Exception, Zend\Validator\Barcode as BarcodeValidator, Zend\Stdlib\ArrayUtils; @@ -35,7 +34,7 @@ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class AbstractObject implements Barcode\Object +abstract class AbstractObject implements ObjectInterface { /** * Namespace of the barcode for autoloading @@ -245,7 +244,7 @@ protected function getDefaultOptions() /** * Set barcode state from options array * @param array $options - * @return \Zend\Barcode\Object + * @return \Zend\Barcode\Object\ObjectInterface */ public function setOptions($options) { @@ -262,7 +261,7 @@ public function setOptions($options) * Set barcode namespace for autoloading * * @param string $namespace - * @return \Zend\Barcode\Object + * @return \Zend\Barcode\Object\ObjectInterface */ public function setBarcodeNamespace($namespace) { @@ -292,8 +291,8 @@ public function getType() /** * Set height of the barcode bar * @param integer $value - * @return \Zend\Barcode\Object - * @throw \Zend\Barcode\Object\Exception + * @return \Zend\Barcode\Object\ObjectInterface + * @throw \Zend\Barcode\Object\Exception\ExceptionInterface */ public function setBarHeight($value) { @@ -318,8 +317,8 @@ public function getBarHeight() /** * Set thickness of thin bar * @param integer $value - * @return \Zend\Barcode\Object - * @throw \Zend\Barcode\Object\Exception + * @return \Zend\Barcode\Object\ObjectInterface + * @throw \Zend\Barcode\Object\Exception\ExceptionInterface */ public function setBarThinWidth($value) { @@ -344,8 +343,8 @@ public function getBarThinWidth() /** * Set thickness of thick bar * @param integer $value - * @return \Zend\Barcode\Object - * @throw \Zend\Barcode\Object\Exception + * @return \Zend\Barcode\Object\ObjectInterface + * @throw \Zend\Barcode\Object\Exception\ExceptionInterface */ public function setBarThickWidth($value) { @@ -371,8 +370,8 @@ public function getBarThickWidth() * Set factor applying to * thinBarWidth - thickBarWidth - barHeight - fontSize * @param float $value - * @return \Zend\Barcode\Object - * @throw \Zend\Barcode\Object\Exception + * @return \Zend\Barcode\Object\ObjectInterface + * @throw \Zend\Barcode\Object\Exception\ExceptionInterface */ public function setFactor($value) { @@ -398,8 +397,8 @@ public function getFactor() /** * Set color of the barcode and text * @param string $value - * @return \Zend\Barcode\Object - * @throw \Zend\Barcode\Object\Exception + * @return \Zend\Barcode\Object\ObjectInterface + * @throw \Zend\Barcode\Object\Exception\ExceptionInterface */ public function setForeColor($value) { @@ -427,8 +426,8 @@ public function getForeColor() /** * Set the color of the background * @param integer $value - * @return \Zend\Barcode\Object - * @throw \Zend\Barcode\Object\Exception + * @return \Zend\Barcode\Object\ObjectInterface + * @throw \Zend\Barcode\Object\Exception\ExceptionInterface */ public function setBackgroundColor($value) { @@ -456,7 +455,7 @@ public function getBackgroundColor() /** * Activate/deactivate drawing of the bar * @param boolean $value - * @return \Zend\Barcode\Object + * @return \Zend\Barcode\Object\ObjectInterface */ public function setWithBorder($value) { @@ -495,7 +494,7 @@ public function getWithQuietZones() /** * Allow fast inversion of font/bars color and background color - * @return \Zend\Barcode\Object + * @return \Zend\Barcode\Object\ObjectInterface */ public function setReverseColor() { @@ -508,8 +507,8 @@ public function setReverseColor() /** * Set orientation of barcode and text * @param float $value - * @return \Zend\Barcode\Object - * @throw \Zend\Barcode\Object\Exception + * @return \Zend\Barcode\Object\ObjectInterface + * @throw \Zend\Barcode\Object\Exception\ExceptionInterface */ public function setOrientation($value) { @@ -529,7 +528,7 @@ public function getOrientation() /** * Set text to encode * @param string $value - * @return \Zend\Barcode\Object + * @return \Zend\Barcode\Object\ObjectInterface */ public function setText($value) { @@ -598,7 +597,7 @@ public function getTextToDisplay() /** * Activate/deactivate drawing of text to encode * @param boolean $value - * @return \Zend\Barcode\Object + * @return \Zend\Barcode\Object\ObjectInterface */ public function setDrawText($value) { @@ -619,8 +618,8 @@ public function getDrawText() * Activate/deactivate the adjustment of the position * of the characters to the position of the bars * @param boolean $value - * @return \Zend\Barcode\Object - * @throw \Zend\Barcode\Object\Exception + * @return \Zend\Barcode\Object\ObjectInterface + * @throw \Zend\Barcode\Object\Exception\ExceptionInterface */ public function setStretchText($value) { @@ -643,7 +642,7 @@ public function getStretchText() * of the checksum character * added to the barcode text * @param boolean $value - * @return \Zend\Barcode\Object + * @return \Zend\Barcode\Object\ObjectInterface */ public function setWithChecksum($value) { @@ -668,8 +667,8 @@ public function getWithChecksum() * of the checksum character * added to the barcode text * @param boolean $value - * @return \Zend\Barcode\Object - * @throw \Zend\Barcode\Object\Exception + * @return \Zend\Barcode\Object\ObjectInterface + * @throw \Zend\Barcode\Object\Exception\ExceptionInterface */ public function setWithChecksumInText($value) { @@ -694,8 +693,8 @@ public function getWithChecksumInText() * - if integer between 1 and 5, use gd built-in fonts * - if string, $value is assumed to be the path to a TTF font * @param integer|string $value - * @return \Zend\Barcode\Object - * @throw \Zend\Barcode\Object\Exception + * @return \Zend\Barcode\Object\ObjectInterface + * @throw \Zend\Barcode\Object\Exception\ExceptionInterface */ public function setFont($value) { @@ -734,8 +733,8 @@ public function getFont() /** * Set the size of the font in case of TTF * @param float $value - * @return \Zend\Barcode\Object - * @throw \Zend\Barcode\Object\Exception + * @return \Zend\Barcode\Object\ObjectInterface + * @throw \Zend\Barcode\Object\Exception\ExceptionInterface */ public function setFontSize($value) { @@ -863,7 +862,7 @@ public function checkParams() /** * Check if a text is really provided to barcode * @return void - * @throw \Zend\Barcode\Object\Exception + * @throw \Zend\Barcode\Object\Exception\ExceptionInterface */ protected function checkText($value = null) { @@ -883,7 +882,7 @@ protected function checkText($value = null) * @param integer $min * @param integer $max * @return void - * @throw \Zend\Barcode\Object\Exception + * @throw \Zend\Barcode\Object\Exception\ExceptionInterface */ protected function checkRatio($min = 2, $max = 3) { @@ -901,7 +900,7 @@ protected function checkRatio($min = 2, $max = 3) /** * Drawing with an angle is just allow TTF font * @return void - * @throw \Zend\Barcode\Object\Exception + * @throw \Zend\Barcode\Object\Exception\ExceptionInterface */ protected function checkFontAndOrientation() { diff --git a/src/Object/Ean8.php b/src/Object/Ean8.php index 7ce1a2d..4f2d9af 100644 --- a/src/Object/Ean8.php +++ b/src/Object/Ean8.php @@ -21,8 +21,7 @@ namespace Zend\Barcode\Object; -use Zend\Barcode\Object\Exception, - Zend\Validator\Barcode as BarcodeValidator; +use Zend\Validator\Barcode as BarcodeValidator; /** * Class for generate Ean8 barcode diff --git a/src/Object/Exception/BarcodeValidationException.php b/src/Object/Exception/BarcodeValidationException.php index af6f39d..f89e858 100644 --- a/src/Object/Exception/BarcodeValidationException.php +++ b/src/Object/Exception/BarcodeValidationException.php @@ -21,8 +21,6 @@ namespace Zend\Barcode\Object\Exception; -use Zend\Barcode\Object\Exception; - /** * Exception for Zend_Barcode component. * @@ -33,6 +31,6 @@ */ class BarcodeValidationException extends \Exception - implements Exception + implements ExceptionInterface { } diff --git a/src/Object/Exception.php b/src/Object/Exception/ExceptionInterface.php similarity index 81% rename from src/Object/Exception.php rename to src/Object/Exception/ExceptionInterface.php index 3a138b8..84ea708 100644 --- a/src/Object/Exception.php +++ b/src/Object/Exception/ExceptionInterface.php @@ -14,22 +14,24 @@ * * @category Zend * @package Zend_Barcode + * @subpackage Object_Exception * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -namespace Zend\Barcode\Object; +namespace Zend\Barcode\Object\Exception; -use Zend\Barcode\Exception as BarcodeException; +use Zend\Barcode\Exception\ExceptionInterface as BarcodeException; /** * Base exception interface for barcode objects * * @category Zend * @package Zend_Barcode + * @subpackage Object_Exception * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface Exception extends BarcodeException +interface ExceptionInterface extends BarcodeException { } diff --git a/src/Object/Exception/ExtensionNotLoadedException.php b/src/Object/Exception/ExtensionNotLoadedException.php index 935686c..09a2112 100644 --- a/src/Object/Exception/ExtensionNotLoadedException.php +++ b/src/Object/Exception/ExtensionNotLoadedException.php @@ -31,6 +31,6 @@ */ class ExtensionNotLoadedException extends \RuntimeException - implements \Zend\Barcode\Object\Exception + implements ExceptionInterface { } diff --git a/src/Object/Exception/InvalidArgumentException.php b/src/Object/Exception/InvalidArgumentException.php index 71fb666..9c550b2 100644 --- a/src/Object/Exception/InvalidArgumentException.php +++ b/src/Object/Exception/InvalidArgumentException.php @@ -21,8 +21,6 @@ namespace Zend\Barcode\Object\Exception; -use Zend\Barcode\Object\Exception; - /** * Exception for Zend_Barcode component. * @@ -33,6 +31,6 @@ */ class InvalidArgumentException extends \InvalidArgumentException - implements Exception + implements ExceptionInterface { } diff --git a/src/Object/Exception/OutOfRangeException.php b/src/Object/Exception/OutOfRangeException.php index 0f45a21..4be2aba 100644 --- a/src/Object/Exception/OutOfRangeException.php +++ b/src/Object/Exception/OutOfRangeException.php @@ -21,8 +21,6 @@ namespace Zend\Barcode\Object\Exception; -use Zend\Barcode\Object\Exception; - /** * Exception for Zend_Barcode component. * @@ -33,6 +31,6 @@ */ class OutOfRangeException extends \OutOfRangeException - implements Exception + implements ExceptionInterface { } diff --git a/src/Object/Exception/RuntimeException.php b/src/Object/Exception/RuntimeException.php index 70edeae..f1128dc 100644 --- a/src/Object/Exception/RuntimeException.php +++ b/src/Object/Exception/RuntimeException.php @@ -21,8 +21,6 @@ namespace Zend\Barcode\Object\Exception; -use Zend\Barcode\Object\Exception; - /** * Exception for Zend_Barcode component. * @@ -33,6 +31,6 @@ */ class RuntimeException extends \RuntimeException - implements Exception + implements ExceptionInterface { } diff --git a/src/Object.php b/src/Object/ObjectInterface.php similarity index 90% rename from src/Object.php rename to src/Object/ObjectInterface.php index 503dfae..971c902 100644 --- a/src/Object.php +++ b/src/Object/ObjectInterface.php @@ -19,17 +19,18 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ -namespace Zend\Barcode; +namespace Zend\Barcode\Object; /** * Interface for generate Barcode * * @category Zend * @package Zend_Barcode + * @subpackage Object * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface Object +interface ObjectInterface { /** * Constructor @@ -41,7 +42,7 @@ public function __construct($options = null); /** * Set barcode state from options array * @param array $options - * @return Object + * @return Object\ObjectInterface */ public function setOptions($options); @@ -49,7 +50,7 @@ public function setOptions($options); * Set barcode namespace for autoloading * * @param string $namespace - * @return Object + * @return Object\ObjectInterface */ public function setBarcodeNamespace($namespace); @@ -69,7 +70,7 @@ public function getType(); /** * Set height of the barcode bar * @param integer $value - * @return Object + * @return Object\ObjectInterface */ public function setBarHeight($value); @@ -82,7 +83,7 @@ public function getBarHeight(); /** * Set thickness of thin bar * @param integer $value - * @return Object + * @return Object\ObjectInterface */ public function setBarThinWidth($value); @@ -95,7 +96,7 @@ public function getBarThinWidth(); /** * Set thickness of thick bar * @param integer $value - * @return Object + * @return Object\ObjectInterface */ public function setBarThickWidth($value); @@ -109,7 +110,7 @@ public function getBarThickWidth(); * Set factor applying to * thinBarWidth - thickBarWidth - barHeight - fontSize * @param integer $value - * @return Object + * @return Object\ObjectInterface */ public function setFactor($value); @@ -123,7 +124,7 @@ public function getFactor(); /** * Set color of the barcode and text * @param string $value - * @return Object + * @return Object\ObjectInterface */ public function setForeColor($value); @@ -136,7 +137,7 @@ public function getForeColor(); /** * Set the color of the background * @param integer $value - * @return Object + * @return Object\ObjectInterface */ public function setBackgroundColor($value); @@ -149,7 +150,7 @@ public function getBackgroundColor(); /** * Activate/deactivate drawing of the bar * @param boolean $value - * @return Object + * @return Object\ObjectInterface */ public function setWithBorder($value); @@ -161,14 +162,14 @@ public function getWithBorder(); /** * Allow fast inversion of font/bars color and background color - * @return Object + * @return Object\ObjectInterface */ public function setReverseColor(); /** * Set orientation of barcode and text * @param float $value - * @return Object + * @return Object\ObjectInterface */ public function setOrientation($value); @@ -181,7 +182,7 @@ public function getOrientation(); /** * Set text to encode * @param string $value - * @return Object + * @return Object\ObjectInterface */ public function setText($value); @@ -206,7 +207,7 @@ public function getTextToDisplay(); /** * Activate/deactivate drawing of text to encode * @param boolean $value - * @return Object + * @return Object\ObjectInterface */ public function setDrawText($value); @@ -220,7 +221,7 @@ public function getDrawText(); * Activate/deactivate the adjustment of the position * of the characters to the position of the bars * @param boolean $value - * @return Object + * @return Object\ObjectInterface */ public function setStretchText($value); @@ -236,7 +237,7 @@ public function getStretchText(); * of the checksum character * added to the barcode text * @param boolean $value - * @return Object + * @return Object\ObjectInterface */ public function setWithChecksum($value); @@ -252,7 +253,7 @@ public function getWithChecksum(); * of the checksum character * added to the barcode text * @param boolean $value - * @return Object + * @return Object\ObjectInterface */ public function setWithChecksumInText($value); @@ -268,7 +269,7 @@ public function getWithChecksumInText(); * - if integer between 1 and 5, use gd built-in fonts * - if string, $value is assumed to be the path to a TTF font * @param integer|string $value - * @return Object + * @return Object\ObjectInterface */ public function setFont($value); @@ -281,7 +282,7 @@ public function getFont(); /** * Set the size of the font in case of TTF * @param float $value - * @return Object + * @return Object\ObjectInterface */ public function setFontSize($value); diff --git a/src/Object/Upce.php b/src/Object/Upce.php index 1234765..6e4e72c 100644 --- a/src/Object/Upce.php +++ b/src/Object/Upce.php @@ -21,8 +21,7 @@ namespace Zend\Barcode\Object; -use Zend\Validator\Barcode as BarcodeValidator, - Zend\Barcode\Object\Exception; +use Zend\Validator\Barcode as BarcodeValidator; /** * Class for generate UpcA barcode diff --git a/src/Renderer/AbstractRenderer.php b/src/Renderer/AbstractRenderer.php index 3a2a97e..11aacd2 100644 --- a/src/Renderer/AbstractRenderer.php +++ b/src/Renderer/AbstractRenderer.php @@ -25,7 +25,6 @@ Zend\Barcode\Barcode, Zend\Barcode\Exception as BarcodeException, Zend\Barcode\Object, - Zend\Barcode\Renderer, Zend\Stdlib\ArrayUtils; /** @@ -36,7 +35,7 @@ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class AbstractRenderer implements Renderer +abstract class AbstractRenderer implements RendererInterface { /** * Namespace of the renderer for autoloading @@ -88,7 +87,7 @@ abstract class AbstractRenderer implements Renderer /** * Barcode object - * @var Object + * @var Object\ObjectInterface */ protected $barcode; @@ -315,12 +314,12 @@ public function getAutomaticRenderError() /** * Set the barcode object - * @param Object $barcode + * @param Object\ObjectInterface $barcode * @return AbstractRenderer */ public function setBarcode($barcode) { - if (!$barcode instanceof Object) { + if (!$barcode instanceof Object\ObjectInterface) { throw new Exception\InvalidArgumentException( 'Invalid barcode object provided to setBarcode()' ); @@ -331,7 +330,7 @@ public function setBarcode($barcode) /** * Retrieve the barcode object - * @return Object + * @return Object\ObjectInterface */ public function getBarcode() { @@ -417,7 +416,7 @@ public function draw() $this->checkParams(); $this->initRenderer(); $this->drawInstructionList(); - } catch (BarcodeException $e) { + } catch (BarcodeException\ExceptionInterface $e) { if ($this->automaticRenderError && !($e instanceof BarcodeException\RendererCreationException)) { $barcode = Barcode::makeBarcode( 'error', diff --git a/src/Renderer/Exception.php b/src/Renderer/Exception/ExceptionInterface.php similarity index 85% rename from src/Renderer/Exception.php rename to src/Renderer/Exception/ExceptionInterface.php index 782432d..c57d00c 100644 --- a/src/Renderer/Exception.php +++ b/src/Renderer/Exception/ExceptionInterface.php @@ -18,9 +18,9 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ -namespace Zend\Barcode\Renderer; +namespace Zend\Barcode\Renderer\Exception; -use Zend\Barcode\Exception as BarcodeException; +use Zend\Barcode\Exception\ExceptionInterface as BarcodeException; /** * @category Zend @@ -28,6 +28,6 @@ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface Exception extends BarcodeException +interface ExceptionInterface extends BarcodeException { } diff --git a/src/Renderer/Exception/InvalidArgumentException.php b/src/Renderer/Exception/InvalidArgumentException.php index 2b162bb..4555cfb 100644 --- a/src/Renderer/Exception/InvalidArgumentException.php +++ b/src/Renderer/Exception/InvalidArgumentException.php @@ -21,8 +21,6 @@ namespace Zend\Barcode\Renderer\Exception; -use Zend\Barcode\Renderer\Exception; - /** * Exception for Zend_Barcode component. * @@ -33,6 +31,6 @@ */ class InvalidArgumentException extends \InvalidArgumentException - implements Exception + implements ExceptionInterface { } diff --git a/src/Renderer/Exception/OutOfRangeException.php b/src/Renderer/Exception/OutOfRangeException.php index ff08cec..90ed532 100644 --- a/src/Renderer/Exception/OutOfRangeException.php +++ b/src/Renderer/Exception/OutOfRangeException.php @@ -21,8 +21,6 @@ namespace Zend\Barcode\Renderer\Exception; -use Zend\Barcode\Renderer\Exception; - /** * Exception for Zend_Barcode component. * @@ -33,6 +31,6 @@ */ class OutOfRangeException extends \OutOfRangeException - implements Exception + implements ExceptionInterface { } diff --git a/src/Renderer/Exception/RuntimeException.php b/src/Renderer/Exception/RuntimeException.php index dbe3ebc..d58c2f6 100644 --- a/src/Renderer/Exception/RuntimeException.php +++ b/src/Renderer/Exception/RuntimeException.php @@ -21,8 +21,6 @@ namespace Zend\Barcode\Renderer\Exception; -use Zend\Barcode\Renderer\Exception; - /** * Exception for Zend_Barcode component. * @@ -33,6 +31,6 @@ */ class RuntimeException extends \RuntimeException - implements Exception + implements ExceptionInterface { } diff --git a/src/Renderer/Exception/UnexpectedValueException.php b/src/Renderer/Exception/UnexpectedValueException.php index 1d00eaf..05500be 100644 --- a/src/Renderer/Exception/UnexpectedValueException.php +++ b/src/Renderer/Exception/UnexpectedValueException.php @@ -21,8 +21,6 @@ namespace Zend\Barcode\Renderer\Exception; -use Zend\Barcode\Renderer\Exception; - /** * Exception for Zend_Barcode component. * @@ -33,6 +31,6 @@ */ class UnexpectedValueException extends \UnexpectedValueException - implements Exception + implements ExceptionInterface { } diff --git a/src/Renderer/Pdf.php b/src/Renderer/Pdf.php index d8f8855..a60fc67 100644 --- a/src/Renderer/Pdf.php +++ b/src/Renderer/Pdf.php @@ -21,8 +21,7 @@ namespace Zend\Barcode\Renderer; -use Zend\Barcode\Renderer\Exception, - Zend\Pdf\Color, +use Zend\Pdf\Color, Zend\Pdf\Font, Zend\Pdf\Page, Zend\Pdf\PdfDocument; @@ -56,19 +55,14 @@ class Pdf extends AbstractRenderer protected $moduleSize = 0.5; /** - * Set an image resource to draw the barcode inside - * @param resource $value - * @return \Zend\Barcode\Renderer - * @throw Exception + * Set a PDF resource to draw the barcode inside + * + * @param PdfDocument $pdf + * @param integer $page + * @return Pdf */ - public function setResource($pdf, $page = 0) + public function setResource(PdfDocument $pdf, $page = 0) { - if (!$pdf instanceof PdfDocument) { - throw new Exception\InvalidArgumentException( - 'Invalid Zend\Pdf\PdfDocument resource provided to setResource()' - ); - } - $this->resource = $pdf; $this->page = intval($page); diff --git a/src/Renderer.php b/src/Renderer/RendererInterface.php similarity index 95% rename from src/Renderer.php rename to src/Renderer/RendererInterface.php index cae428a..6a73127 100644 --- a/src/Renderer.php +++ b/src/Renderer/RendererInterface.php @@ -19,17 +19,18 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ -namespace Zend\Barcode; +namespace Zend\Barcode\Renderer; /** * Class for rendering the barcode * * @category Zend * @package Zend_Barcode + * @subpackage Renderer * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface Renderer +interface RendererInterface { /** * Constructor @@ -145,14 +146,14 @@ public function getAutomaticRenderError(); /** * Set the barcode object - * @param Object $barcode + * @param Object\ObjectInterface $barcode * @return Renderer */ public function setBarcode($barcode); /** * Retrieve the barcode object - * @return Object + * @return Object\ObjectInterface */ public function getBarcode(); diff --git a/test/FactoryTest.php b/test/FactoryTest.php index 42762d8..82fa44e 100644 --- a/test/FactoryTest.php +++ b/test/FactoryTest.php @@ -99,14 +99,14 @@ public function testFactoryWithAutomaticExceptionRendering() public function testFactoryWithoutAutomaticObjectExceptionRendering() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $options = array('barHeight' => - 1); $renderer = Barcode\Barcode::factory('code39', 'image', $options, array(), false); } public function testFactoryWithoutAutomaticRendererExceptionRendering() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception'); + $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $this->checkGDRequirement(); $options = array('imageType' => 'my'); $renderer = Barcode\Barcode::factory('code39', 'image', array(), $options, false); @@ -213,14 +213,14 @@ public function testBarcodeObjectFactoryWithBarcodeAsZendConfig() public function testBarcodeObjectFactoryWithBarcodeAsZendConfigButNoBarcodeParameter() { - $this->setExpectedException('\Zend\Barcode\Exception'); + $this->setExpectedException('\Zend\Barcode\Exception\ExceptionInterface'); $config = new Config(array('barcodeParams' => array('barHeight' => 123) )); $barcode = Barcode\Barcode::makeBarcode($config); } public function testBarcodeObjectFactoryWithBarcodeAsZendConfigAndBadBarcodeParameters() { - $this->setExpectedException('\Zend\Barcode\Exception'); + $this->setExpectedException('\Zend\Barcode\Exception\ExceptionInterface'); $barcode = Barcode\Barcode::makeBarcode('code25', null); } @@ -243,7 +243,7 @@ public function testBarcodeObjectFactoryWithNamespaceExtendStandardLibray() public function testBarcodeObjectFactoryWithNamespaceButWithoutExtendingObjectAbstract() { - $this->setExpectedException('\Zend\Barcode\Exception'); + $this->setExpectedException('\Zend\Barcode\Exception\ExceptionInterface'); $loader = new PrefixPathLoader(array('ZendTest\Barcode\Object\TestAsset' => __DIR__ . '/Object/TestAsset')); Barcode\Barcode::getObjectBroker()->setClassLoader($loader); $barcode = Barcode\Barcode::makeBarcode('barcodeNamespaceWithoutExtendingObjectAbstract'); @@ -300,14 +300,14 @@ public function testBarcodeRendererFactoryWithBarcodeAsZendConfig() public function testBarcodeRendererFactoryWithBarcodeAsZendConfigButNoBarcodeParameter() { - $this->setExpectedException('\Zend\Barcode\Exception'); + $this->setExpectedException('\Zend\Barcode\Exception\ExceptionInterface'); $config = new Config(array('rendererParams' => array('imageType' => 'gif') )); $renderer = Barcode\Barcode::makeRenderer($config); } public function testBarcodeRendererFactoryWithBarcodeAsZendConfigAndBadBarcodeParameters() { - $this->setExpectedException('\Zend\Barcode\Exception'); + $this->setExpectedException('\Zend\Barcode\Exception\ExceptionInterface'); $renderer = Barcode\Barcode::makeRenderer('image', null); } @@ -317,12 +317,12 @@ public function testBarcodeRendererFactoryWithNamespace() $loader = new PrefixPathLoader(array('ZendTest\Barcode\Renderer\TestAsset' => __DIR__ . '/Renderer/TestAsset')); Barcode\Barcode::getRendererBroker()->setClassLoader($loader); $renderer = Barcode\Barcode::makeRenderer('rendererNamespace'); - $this->assertTrue($renderer instanceof \Zend\Barcode\Renderer); + $this->assertTrue($renderer instanceof \Zend\Barcode\Renderer\RendererInterface); } public function testBarcodeFactoryWithNamespaceButWithoutExtendingRendererAbstract() { - $this->setExpectedException('\Zend\Barcode\Exception'); + $this->setExpectedException('\Zend\Barcode\Exception\ExceptionInterface'); $loader = new PrefixPathLoader(array('ZendTest\Barcode\Renderer\TestAsset' => __DIR__ . '/Renderer/TestAsset')); Barcode\Barcode::getRendererBroker()->setClassLoader($loader); $renderer = Barcode\Barcode::makeRenderer('rendererNamespaceWithoutExtendingRendererAbstract'); diff --git a/test/Object/Code25Test.php b/test/Object/Code25Test.php index 992802c..1699f9f 100644 --- a/test/Object/Code25Test.php +++ b/test/Object/Code25Test.php @@ -99,7 +99,7 @@ public function testBadTextAlwaysAllowed() public function testBadTextDetectedIfChecksumWished() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('a'); $this->object->setWithChecksum(true); $this->object->getText(); @@ -113,7 +113,7 @@ public function testCheckGoodParams() public function testCheckParamsWithLowRatio() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('0123456789'); $this->object->setBarThinWidth(21); $this->object->setBarThickWidth(40); @@ -122,7 +122,7 @@ public function testCheckParamsWithLowRatio() public function testCheckParamsWithHighRatio() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\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 0363e85..620b7a7 100644 --- a/test/Object/Code25interleavedTest.php +++ b/test/Object/Code25interleavedTest.php @@ -125,7 +125,7 @@ public function testBadTextAlwaysAllowed() public function testBadTextDetectedIfChecksumWished() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('a'); $this->object->setWithChecksum(true); $this->object->getText(); @@ -139,7 +139,7 @@ public function testCheckGoodParams() public function testCheckParamsWithLowRatio() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('0123456789'); $this->object->setBarThinWidth(21); $this->object->setBarThickWidth(40); @@ -148,7 +148,7 @@ public function testCheckParamsWithLowRatio() public function testCheckParamsWithHighRatio() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\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 a705707..cb8fb47 100644 --- a/test/Object/Code39Test.php +++ b/test/Object/Code39Test.php @@ -92,7 +92,7 @@ public function testBadTextAlwaysAllowed() public function testBadTextDetectedIfChecksumWished() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('&'); $this->object->setWithChecksum(true); $this->object->getText(); @@ -106,7 +106,7 @@ public function testCheckGoodParams() public function testCheckParamsWithLowRatio() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('TEST'); $this->object->setBarThinWidth(21); $this->object->setBarThickWidth(40); @@ -115,7 +115,7 @@ public function testCheckParamsWithLowRatio() public function testCheckParamsWithHighRatio() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\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 492c6ce..e1461a6 100644 --- a/test/Object/Ean13Test.php +++ b/test/Object/Ean13Test.php @@ -91,7 +91,7 @@ public function testSetTextWithChecksumNotDisplayed() public function testBadTextDetectedIfChecksumWished() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\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 645e170..a00e7d4 100644 --- a/test/Object/Ean8Test.php +++ b/test/Object/Ean8Test.php @@ -91,7 +91,7 @@ public function testSetTextWithChecksumNotDisplayed() public function testBadTextDetectedIfChecksumWished() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\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 6ec8420..08ac14b 100644 --- a/test/Object/IdentcodeTest.php +++ b/test/Object/IdentcodeTest.php @@ -91,7 +91,7 @@ public function testSetTextWithChecksumNotDisplayed() public function testBadTextDetectedIfChecksumWished() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\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 7e97d57..a0c261c 100644 --- a/test/Object/Itf14Test.php +++ b/test/Object/Itf14Test.php @@ -91,7 +91,7 @@ public function testSetTextWithChecksumNotDisplayed() public function testBadTextDetectedIfChecksumWished() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('a'); $this->object->setWithChecksum(true); $this->object->getText(); @@ -105,7 +105,7 @@ public function testCheckGoodParams() public function testCheckParamsWithLowRatio() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('0000123456789'); $this->object->setBarThinWidth(21); $this->object->setBarThickWidth(40); @@ -114,7 +114,7 @@ public function testCheckParamsWithLowRatio() public function testCheckParamsWithHighRatio() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\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 71832eb..3574f56 100644 --- a/test/Object/LeitcodeTest.php +++ b/test/Object/LeitcodeTest.php @@ -91,7 +91,7 @@ public function testSetTextWithChecksumNotDisplayed() public function testBadTextDetectedIfChecksumWished() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\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 45e4af9..87cbd71 100644 --- a/test/Object/PlanetTest.php +++ b/test/Object/PlanetTest.php @@ -58,7 +58,7 @@ public function testSetText() public function testSetTextWithoutGoodNumberOfCharacters() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('1234'); $this->object->getText(); } @@ -91,7 +91,7 @@ public function testSetTextWithChecksumNotDisplayed() public function testBadTextDetectedIfChecksumWished() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\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 eee951e..d8a2655 100644 --- a/test/Object/PostnetTest.php +++ b/test/Object/PostnetTest.php @@ -58,7 +58,7 @@ public function testSetText() public function testSetTextWithoutGoodNumberOfCharacters() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('1234'); $this->object->getText(); } @@ -91,7 +91,7 @@ public function testSetTextWithChecksumNotDisplayed() public function testBadTextDetectedIfChecksumWished() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\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 db34600..8c15d9e 100644 --- a/test/Object/RoyalmailTest.php +++ b/test/Object/RoyalmailTest.php @@ -85,7 +85,7 @@ public function testSetTextWithChecksumNotDisplayed() public function testBadTextDetectedIfChecksumWished() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\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 ef4c9cc..5cd8e38 100644 --- a/test/Object/TestCommon.php +++ b/test/Object/TestCommon.php @@ -118,7 +118,7 @@ public function testBarHeight() public function testNegativeBarHeight() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setBarHeight(- 1); } @@ -134,7 +134,7 @@ public function testBarThinWidth() public function testNegativeBarThinWidth() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setBarThinWidth(- 1); } @@ -150,7 +150,7 @@ public function testBarThickWidth() public function testNegativeBarThickWidth() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setBarThickWidth(- 1); } @@ -168,7 +168,7 @@ public function testFactor() public function testNegativeFactor() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setFactor(- 1); } @@ -182,13 +182,13 @@ public function testForeColor() public function testNegativeForeColor() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setForeColor(- 1); } public function testTooHighForeColor() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setForeColor(16777126); } @@ -202,13 +202,13 @@ public function testBackgroundColor() public function testNegativeBackgroundColor() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setBackgroundColor(- 1); } public function testTooHighBackgroundColor() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setBackgroundColor(16777126); } @@ -300,13 +300,13 @@ public function testSetFontAsNumberForGdImage() public function testSetLowFontAsNumberForGdImage() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setFont(0); } public function testSetHighFontAsNumberForGdImage() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setFont(6); } @@ -318,7 +318,7 @@ public function testSetFontAsString() public function testSetFontAsBoolean() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setFont(true); } @@ -328,7 +328,7 @@ public function testFontAsNumberWithoutGd() $this->markTestSkipped( 'GD extension must not be loaded to run this test'); } - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setFont(1); } @@ -351,7 +351,7 @@ public function testFontSizeWithoutEffectWithGdInternalFont() public function testStringFontSize() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setFontSize('22a'); } @@ -442,7 +442,7 @@ public function testAddTextWithDefaultColor() public function testCheckParamsFontWithOrientation() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\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 fd2a258..d6b18a1 100644 --- a/test/Object/UpcaTest.php +++ b/test/Object/UpcaTest.php @@ -91,7 +91,7 @@ public function testSetTextWithChecksumNotDisplayed() public function testBadTextDetectedIfChecksumWished() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\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 28d9945..11c3011 100644 --- a/test/Object/UpceTest.php +++ b/test/Object/UpceTest.php @@ -99,7 +99,7 @@ public function testSetTextWithChecksumNotDisplayed() public function testBadTextDetectedIfChecksumWished() { - $this->setExpectedException('\Zend\Barcode\Object\Exception'); + $this->setExpectedException('\Zend\Barcode\Object\Exception\ExceptionInterface'); $this->object->setText('a'); $this->object->setWithChecksum(true); $this->object->getText(); diff --git a/test/Renderer/ImageTest.php b/test/Renderer/ImageTest.php index b643400..4ca1097 100644 --- a/test/Renderer/ImageTest.php +++ b/test/Renderer/ImageTest.php @@ -60,7 +60,7 @@ public function testGoodImageResource() public function testObjectImageResource() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception'); + $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $imageResource = new \StdClass(); $this->renderer->setResource($imageResource); } @@ -76,7 +76,7 @@ public function testGoodHeight() public function testBadHeight() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception'); + $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $this->renderer->setHeight(- 1); } @@ -91,7 +91,7 @@ public function testGoodWidth() public function testBadWidth() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception'); + $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $this->renderer->setWidth(- 1); } @@ -108,7 +108,7 @@ public function testAllowedImageType() public function testNonAllowedImageType() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception'); + $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $this->renderer->setImageType('other'); } @@ -146,7 +146,7 @@ public function testGoodUserHeight() public function testBadUserHeightLessThanBarcodeHeight() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception'); + $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $barcode = new Object\Code39(array('text' => '0123456789')); $this->assertEquals(62, $barcode->getHeight()); $this->renderer->setBarcode($barcode); @@ -165,7 +165,7 @@ public function testGoodUserWidth() public function testBadUserWidthLessThanBarcodeWidth() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception'); + $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $barcode = new Object\Code39(array('text' => '0123456789')); $this->assertEquals(211, $barcode->getWidth()); $this->renderer->setBarcode($barcode); @@ -185,7 +185,7 @@ public function testGoodHeightOfUserResource() public function testBadHeightOfUserResource() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception'); + $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $barcode = new Object\Code39(array('text' => '0123456789')); $this->assertEquals(62, $barcode->getHeight()); $this->renderer->setBarcode($barcode); @@ -206,7 +206,7 @@ public function testGoodWidthOfUserResource() public function testBadWidthOfUserResource() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception'); + $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $barcode = new Object\Code39(array('text' => '0123456789')); $this->assertEquals(211, $barcode->getWidth()); $this->renderer->setBarcode($barcode); @@ -217,7 +217,7 @@ public function testBadWidthOfUserResource() public function testNoFontWithOrientation() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception'); + $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); Barcode\Barcode::setBarcodeFont(null); $barcode = new Object\Code39(array('text' => '0123456789')); $barcode->setOrientation(1); @@ -232,7 +232,7 @@ protected function getRendererWithWidth500AndHeight300() public function testRendererWithUnkownInstructionProvideByObject() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception'); + $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); parent::testRendererWithUnkownInstructionProvideByObject(); } diff --git a/test/Renderer/PdfTest.php b/test/Renderer/PdfTest.php index ebd2d01..629ca1f 100644 --- a/test/Renderer/PdfTest.php +++ b/test/Renderer/PdfTest.php @@ -52,7 +52,7 @@ public function testGoodPdfResource() public function testObjectPdfResource() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception'); + $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $pdfResource = new \StdClass(); $this->renderer->setResource($pdfResource); } diff --git a/test/Renderer/SvgTest.php b/test/Renderer/SvgTest.php index a185cee..2e54c93 100644 --- a/test/Renderer/SvgTest.php +++ b/test/Renderer/SvgTest.php @@ -56,7 +56,7 @@ public function testGoodHeight() public function testBadHeight() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception'); + $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $this->renderer->setHeight(-1); } @@ -71,7 +71,7 @@ public function testGoodWidth() public function testBadWidth() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception'); + $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $this->renderer->setWidth(-1); } @@ -83,7 +83,7 @@ public function testGoodSvgResource() public function testObjectSvgResource() { - $this->setExpectedException('Zend\Barcode\Renderer\Exception'); + $this->setExpectedException('Zend\Barcode\Renderer\Exception\ExceptionInterface'); $svgResource = new \StdClass(); $this->renderer->setResource($svgResource); } diff --git a/test/Renderer/TestCommon.php b/test/Renderer/TestCommon.php index b919487..6379107 100644 --- a/test/Renderer/TestCommon.php +++ b/test/Renderer/TestCommon.php @@ -76,7 +76,7 @@ public function testSetBarcodeObject() public function testSetInvalidBarcodeObject() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception'); + $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $barcode = new \StdClass(); $this->renderer->setBarcode($barcode); } @@ -89,13 +89,13 @@ public function testGoodModuleSize() public function testModuleSizeAsString() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception'); + $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $this->renderer->setModuleSize('abc'); } public function testModuleSizeLessThan0() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception'); + $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $this->renderer->setModuleSize(-0.5); } @@ -118,7 +118,7 @@ public function testGoodHorizontalPosition() public function testBadHorizontalPosition() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception'); + $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $this->renderer->setHorizontalPosition('none'); } @@ -133,7 +133,7 @@ public function testGoodVerticalPosition() public function testBadVerticalPosition() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception'); + $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $this->renderer->setVerticalPosition('none'); } @@ -148,7 +148,7 @@ public function testGoodLeftOffset() public function testBadLeftOffset() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception'); + $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $this->renderer->setLeftOffset(- 1); } @@ -163,7 +163,7 @@ public function testGoodTopOffset() public function testBadTopOffset() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception'); + $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $this->renderer->setTopOffset(- 1); } @@ -201,7 +201,7 @@ public function testRendererNamespace() public function testRendererWithUnkownInstructionProvideByObject() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception'); + $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $object = new TestAsset\BarcodeTest(); $object->setText('test'); $object->addTestInstruction(array('type' => 'unknown')); @@ -211,7 +211,7 @@ public function testRendererWithUnkownInstructionProvideByObject() public function testBarcodeObjectProvided() { - $this->setExpectedException('\Zend\Barcode\Renderer\Exception'); + $this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface'); $this->renderer->draw(); }