diff --git a/CHANGELOG.md b/CHANGELOG.md index e143b51..ef373e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Changed - Add PHP 7.2 by name in Travis as PHP nightly seems to be PHP 7.3-dev +- Removed unfinished support for Red Payment Slip (ES) ### Fixed diff --git a/README.md b/README.md index 12b1494..3ee7ba7 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,9 @@ Do you need to create Swiss payment slips (called ES or ESR) as PDF files in a p Then you found almost the right place, go to [SwissPaymentSlipFpdf](https://github.com/ravage84/SwissPaymentSlipFpdf) or [SwissPaymentSlipTcpdf](https://github.com/ravage84/SwissPaymentSlipTcpdf). -If you need to include some basic logic for Swiss payment slips iny our PHP code base then you are probably right though... +If you need to include some basic logic for Swiss payment slips in your PHP code base then you are probably right though... + +The partial and unfinished support for the red payment slip was dropped in version 0.13.0 due to lack of demand. How to use ---------- @@ -60,9 +62,8 @@ I decided myself for the latter. TODOs ----- -- Finish support for red inpayment slips - Improve code documentation -- Add more examples/improve existing ones +- Add more examples/improve existing ones, showcase disabling the various field blocks better - Improve the tests - Release the stable release of the API @@ -75,7 +76,7 @@ Author ------ This project was created by [Marc Würth](https://github.com/ravage84). -See Background Story for more details. +See [Background Story](#background-story) for more details. License ------- diff --git a/composer.json b/composer.json index fa4f2e9..710c040 100644 --- a/composer.json +++ b/composer.json @@ -1,14 +1,13 @@ { "name": "swiss-payment-slip/swiss-payment-slip", - "description": "A library for creating Swiss payment slips", + "description": "A library for creating Swiss payment slips (ESR)", "license": "MIT", "homepage": "https://github.com/ravage84/SwissPaymentSlip", "keywords": [ "Payment slip", "Inpayment slip", "Einzahlungsschein", - "ESR", - "ES" + "ESR" ], "require": { "php": ">=5.4.0" diff --git a/composer.lock b/composer.lock index ca546a9..e6b67c7 100644 --- a/composer.lock +++ b/composer.lock @@ -112,33 +112,33 @@ }, { "name": "phpspec/prophecy", - "version": "v1.7.0", + "version": "1.7.3", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "93d39f1f7f9326d746203c7c056f300f7f126073" + "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/93d39f1f7f9326d746203c7c056f300f7f126073", - "reference": "93d39f1f7f9326d746203c7c056f300f7f126073", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf", + "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", "sebastian/comparator": "^1.1|^2.0", "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, "require-dev": { "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8 || ^5.6.5" + "phpunit/phpunit": "^4.8.35 || ^5.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6.x-dev" + "dev-master": "1.7.x-dev" } }, "autoload": { @@ -171,7 +171,7 @@ "spy", "stub" ], - "time": "2017-03-02T20:05:34+00:00" + "time": "2017-11-24T13:59:53+00:00" }, { "name": "phpunit/php-code-coverage", @@ -237,16 +237,16 @@ }, { "name": "phpunit/php-file-iterator", - "version": "1.4.2", + "version": "1.4.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", "shasum": "" }, "require": { @@ -280,7 +280,7 @@ "filesystem", "iterator" ], - "time": "2016-10-03T07:40:28+00:00" + "time": "2017-11-27T13:52:08+00:00" }, { "name": "phpunit/php-text-template", @@ -374,16 +374,16 @@ }, { "name": "phpunit/php-token-stream", - "version": "1.4.11", + "version": "1.4.12", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7" + "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7", - "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16", + "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16", "shasum": "" }, "require": { @@ -419,7 +419,7 @@ "keywords": [ "tokenizer" ], - "time": "2017-02-27T10:12:30+00:00" + "time": "2017-12-04T08:55:13+00:00" }, { "name": "phpunit/phpunit", @@ -1001,16 +1001,16 @@ }, { "name": "symfony/yaml", - "version": "v2.8.26", + "version": "v2.8.34", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "4c29dec8d489c4e37cf87ccd7166cd0b0e6a45c5" + "reference": "be720fcfae4614df204190d57795351059946a77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/4c29dec8d489c4e37cf87ccd7166cd0b0e6a45c5", - "reference": "4c29dec8d489c4e37cf87ccd7166cd0b0e6a45c5", + "url": "https://api.github.com/repos/symfony/yaml/zipball/be720fcfae4614df204190d57795351059946a77", + "reference": "be720fcfae4614df204190d57795351059946a77", "shasum": "" }, "require": { @@ -1046,7 +1046,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-06-01T20:52:29+00:00" + "time": "2018-01-03T07:36:31+00:00" } ], "aliases": [], diff --git a/examples/RedPaymentSlipData_Basic_Usage.php b/examples/RedPaymentSlipData_Basic_Usage.php deleted file mode 100644 index b9f63d5..0000000 --- a/examples/RedPaymentSlipData_Basic_Usage.php +++ /dev/null @@ -1,74 +0,0 @@ - - * @author Peter Siska - * @link https://github.com/ravage84/SwissPaymentSlip/ - */ -?> - - - - - SwissPaymentSlip Example 01-02: RedPaymentSlipData basic usage - - -

SwissPaymentSlip Example 01-02: RedPaymentSlipData basic usage

-setBankData('Seldwyla Bank', '8021 Zuerich') - ->setAccountNumber('80-939-3') - ->setRecipientData('Muster AG', 'Bahnhofstrasse 5', '8001 Zuerich') - ->setIban('CH3808888123456789012') - ->setPayerData('M. Beispieler', 'Bahnhofstrasse 356', '', '7000 Chur') - ->setAmount(8479.25) - ->setPaymentReasonData('Rechnung', 'Nr.7496'); - -// Output the data fields of the slip -echo "Bank name: " . $paymentSlipData->getBankName() . "
"; -echo "Bank city: " . $paymentSlipData->getBankCity() . "
"; -echo "
"; -echo "Recipient line 1: " . $paymentSlipData->getRecipientLine1() . "
"; -echo "Recipient line 2: " . $paymentSlipData->getRecipientLine2() . "
"; -echo "Recipient line 3: " . $paymentSlipData->getRecipientLine3() . "
"; -echo "Recipient line 4: " . $paymentSlipData->getRecipientLine4() . "
"; -echo "
"; -echo "IBAN: " . $paymentSlipData->getIban() . "
"; -echo "Formatted IBAN: " . $paymentSlipData->getFormattedIban() . "
"; -echo "
"; -echo "Account number: " . $paymentSlipData->getAccountNumber() . "
"; -echo "
"; -echo "Amount: " . $paymentSlipData->getAmount() . "
"; -echo "Amount in francs: " . $paymentSlipData->getAmountFrancs() . "
"; -echo "Amount in cents: " . $paymentSlipData->getAmountCents() . "
"; -echo "
"; -echo "Payer line 1: " . $paymentSlipData->getPayerLine1() . "
"; -echo "Payer line 2: " . $paymentSlipData->getPayerLine2() . "
"; -echo "Payer line 3: " . $paymentSlipData->getPayerLine3() . "
"; -echo "Payer line 4: " . $paymentSlipData->getPayerLine4() . "
"; -echo "
"; -echo "Payment reason line 1: " . $paymentSlipData->getPaymentReasonLine1() . "
"; -echo "Payment reason line 2: " . $paymentSlipData->getPaymentReasonLine2() . "
"; -echo "Payment reason line 3: " . $paymentSlipData->getPaymentReasonLine3() . "
"; -echo "Payment reason line 4: " . $paymentSlipData->getPaymentReasonLine4() . "
"; -echo "
"; - -// Dump object to screen -echo "This is how your data container looks now:
"; -var_dump($paymentSlipData); -?> - - diff --git a/examples/index.php b/examples/index.php index d3955f4..df38682 100644 --- a/examples/index.php +++ b/examples/index.php @@ -21,7 +21,6 @@

Learn how to use the SwissPaymentSlip classes wit the following examples:

diff --git a/phpunit-html-coverage.xml b/phpunit-html-coverage.xml index 9b08f0a..746f57e 100644 --- a/phpunit-html-coverage.xml +++ b/phpunit-html-coverage.xml @@ -8,10 +8,8 @@ ./tests/Exception/DisabledDataExceptionTest.php ./tests/PaymentSlipDataTest.php ./tests/OrangePaymentSlipDataTest.php - ./tests/RedPaymentSlipDataTest.php ./tests/PaymentSlipTest.php ./tests/OrangePaymentSlipTest.php - ./tests/RedPaymentSlipTest.php diff --git a/phpunit.xml.dist b/phpunit.xml.dist index d045c7e..54dab4d 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -8,10 +8,8 @@ ./tests/Exception/DisabledDataExceptionTest.php ./tests/PaymentSlipDataTest.php ./tests/OrangePaymentSlipDataTest.php - ./tests/RedPaymentSlipDataTest.php ./tests/PaymentSlipTest.php ./tests/OrangePaymentSlipTest.php - ./tests/RedPaymentSlipTest.php diff --git a/src/RedPaymentSlip.php b/src/RedPaymentSlip.php deleted file mode 100644 index 4434de5..0000000 --- a/src/RedPaymentSlip.php +++ /dev/null @@ -1,384 +0,0 @@ - - * @author Peter Siska - * @link https://github.com/ravage84/SwissPaymentSlip/ - */ - -namespace SwissPaymentSlip\SwissPaymentSlip; - -/** - * Red Swiss Payment Slip - * - * Describes how a red Swiss payment slip looks like and - * how the various data fields of a red payment slip are - * placed or displayed respectively. - * - * The data of the fields is organized by its sister class RedPaymentSlipData. - * - * @uses RedPaymentSlipData To store the slip data. - */ -class RedPaymentSlip extends PaymentSlip -{ - /** - * The red payment slip value object, which contains the payment slip data - * - * @var RedPaymentSlipData - */ - protected $paymentSlipData = null; - - /** - * The height of the slip - * - * @var int|float - */ - protected $slipHeight = 106; // TODO default height of an red slip - - /** - * The width of the slip - * - * @var int|float - */ - protected $slipWidth = 210; // TODO default width of an red slip - /** - * Determines whether the IBAN should be displayed - * - * @var bool - */ - protected $displayIban = true; - - /** - * Determines whether the payment reason should be displayed - * - * @var bool - */ - protected $displayPaymentReason = true; - - /** - * Attributes of the left IBAN element - * - * @var array - */ - protected $ibanLeftAttr = []; - - /** - * Attributes of the rightIBAN element - * - * @var array - */ - protected $ibanRightAttr = []; - - /** - * Attributes of the payment reason element - * - * @var array - */ - protected $paymentReasonAttr = []; - - /** - * Create a new red payment slip - * - * @param RedPaymentSlipData $paymentSlipData The red payment slip data. - * @param float|null $slipPosX The optional X position of the slip. - * @param float|null $slipPosY The optional Y position of the slip. - */ - public function __construct(RedPaymentSlipData $paymentSlipData, $slipPosX = null, $slipPosY = null) - { - parent::__construct($paymentSlipData, $slipPosX, $slipPosY); - } - - /** - * Sets the default attributes of the elements for a red slip - * - * @return $this The current instance for a fluent interface. - * @todo Set default attributes for $ibanLeftAttr, $ibanRightAttr & $paymentReasonAttr - */ - protected function setDefaults() - { - parent::setDefaults(); - - $this->setIbanLeftAttr(); - $this->setIbanRightAttr(); - $this->setPaymentReasonAttr(); - - $this->setSlipBackground(__DIR__.'/Resources/img/ezs_red.gif'); - - return $this; - } - - /** - * Get the slip data object of the slip - * - * @return RedPaymentSlipData The data object of the slip. - */ - public function getPaymentSlipData() - { - return parent::getPaymentSlipData(); - } - - /** - * Set the left IBAN attributes - * - * @param float|null $posX The X position. - * @param float|null $posY The Y Position. - * @param float|null $width The width. - * @param float|null $height The height. - * @param string|null $background The background. - * @param string|null $fontFamily The font family. - * @param float|null $fontSize The font size. - * @param string|null $fontColor The font color. - * @param float|null $lineHeight The line height. - * @param string|null $textAlign The text alignment. - * @return $this The current instance for a fluent interface. - */ - public function setIbanLeftAttr( - $posX = null, - $posY = null, - $width = null, - $height = null, - $background = null, - $fontFamily = null, - $fontSize = null, - $fontColor = null, - $lineHeight = null, - $textAlign = null - ) { - $this->setAttributes( - $this->ibanLeftAttr, - $posX, - $posY, - $width, - $height, - $background, - $fontFamily, - $fontSize, - $fontColor, - $lineHeight, - $textAlign - ); - - return $this; - } - - /** - * Set the right IBAN attributes - * - * @param float|null $posX The X position. - * @param float|null $posY The Y Position. - * @param float|null $width The width. - * @param float|null $height The height. - * @param string|null $background The background. - * @param string|null $fontFamily The font family. - * @param float|null $fontSize The font size. - * @param string|null $fontColor The font color. - * @param float|null $lineHeight The line height. - * @param string|null $textAlign The text alignment. - * @return $this The current instance for a fluent interface. - */ - public function setIbanRightAttr( - $posX = null, - $posY = null, - $width = null, - $height = null, - $background = null, - $fontFamily = null, - $fontSize = null, - $fontColor = null, - $lineHeight = null, - $textAlign = null - ) { - $this->setAttributes( - $this->ibanRightAttr, - $posX, - $posY, - $width, - $height, - $background, - $fontFamily, - $fontSize, - $fontColor, - $lineHeight, - $textAlign - ); - - return $this; - } - - /** - * Get the attributes of the left IBAN element - * - * @return array The attributes of the left IBAN element. - */ - public function getIbanLeftAttr() - { - return $this->ibanLeftAttr; - } - - /** - * Get the attributes of the right IBAN element - * - * @return array The attributes of the right IBAN element. - */ - public function getIbanRightAttr() - { - return $this->ibanRightAttr; - } - - /** - * Set the payment reason attributes - * - * @param float|null $posX The X position. - * @param float|null $posY The Y Position. - * @param float|null $width The width. - * @param float|null $height The height. - * @param string|null $background The background. - * @param string|null $fontFamily The font family. - * @param float|null $fontSize The font size. - * @param string|null $fontColor The font color. - * @param float|null $lineHeight The line height. - * @param string|null $textAlign The text alignment. - * @return $this The current instance for a fluent interface. - */ - public function setPaymentReasonAttr( - $posX = null, - $posY = null, - $width = null, - $height = null, - $background = null, - $fontFamily = null, - $fontSize = null, - $fontColor = null, - $lineHeight = null, - $textAlign = null - ) { - $this->setAttributes( - $this->paymentReasonAttr, - $posX, - $posY, - $width, - $height, - $background, - $fontFamily, - $fontSize, - $fontColor, - $lineHeight, - $textAlign - ); - - return $this; - } - - /** - * Get the attributes of the payment reason element - * - * @return array The attributes of the payment reason element. - */ - public function getPaymentReasonAttr() - { - return $this->paymentReasonAttr; - } - - /** - * Set whether or not to display the IBAN - * - * @param bool $displayIban True if yes, false if no - * @return $this The current instance for a fluent interface. - */ - public function setDisplayIban($displayIban = true) - { - $this->isBool($displayIban, 'displayIban'); - $this->displayIban = $displayIban; - - return $this; - } - - /** - * Get whether or not to display the IBAN - * - * @return bool True if yes, false if no. - */ - public function getDisplayIban() - { - if ($this->getPaymentSlipData()->getWithIban() !== true) { - return false; - } - return $this->displayIban; - } - - /** - * Set whether or not to display the payment reason lines - * - * @param bool $displayPaymentReason True if yes, false if no - * @return $this The current instance for a fluent interface. - */ - public function setDisplayPaymentReason($displayPaymentReason = true) - { - $this->isBool($displayPaymentReason, 'displayPaymentReason'); - $this->displayPaymentReason = $displayPaymentReason; - - return $this; - } - - /** - * Get whether or not to display the payment reason lines - * - * @return bool True if yes, false if no. - */ - public function getDisplayPaymentReason() - { - if ($this->getPaymentSlipData()->getWithPaymentReason() !== true) { - return false; - } - return $this->displayPaymentReason; - } - - /** - * Get all elements of the slip - * - * @return array All elements with their lines and attributes. - */ - public function getAllElements() - { - $paymentSlipData = $this->paymentSlipData; - - $elements = parent::getAllElements(); - - // Place left IBAN - if ($this->getDisplayIban()) { - $lines = [ - $paymentSlipData->getFormattedIban() - ]; - $elements['IbanLeft'] = ['lines' => $lines, - 'attributes' => $this->getIbanLeftAttr() - ]; - - // Place right IBAN - // Reuse lines from above - $elements['IbanRight'] = [ - 'lines' => $lines, - 'attributes' => $this->getIbanRightAttr() - ]; - } - - if ($this->getDisplayPaymentReason()) { - // Place payment reason lines - $lines = [ - $paymentSlipData->getPaymentReasonLine1(), - $paymentSlipData->getPaymentReasonLine2(), - $paymentSlipData->getPaymentReasonLine3(), - $paymentSlipData->getPaymentReasonLine4() - ]; - $elements['paymentReason'] = [ - 'lines' => $lines, - 'attributes' => $this->getPaymentReasonAttr() - ]; - } - - return $elements; - } -} diff --git a/src/RedPaymentSlipData.php b/src/RedPaymentSlipData.php deleted file mode 100644 index 9eb7b6f..0000000 --- a/src/RedPaymentSlipData.php +++ /dev/null @@ -1,367 +0,0 @@ - - * @author Peter Siska - * @link https://github.com/ravage84/SwissPaymentSlip/ - */ - -namespace SwissPaymentSlip\SwissPaymentSlip; - -use SwissPaymentSlip\SwissPaymentSlip\Exception\DisabledDataException; - -/** - * Red Swiss Payment Slip Data - * - * A data container class to encapsulate all the necessary data - * for a red Swiss payment slip without reference number. - * - * @see PaymentSlipData For more information about the various payment slips. - * - * @todo Implement full red slip support (code line + additional code line) - * @todo Create a getPaymentReason with formatting parameter, e.g. stripping blank lines - */ -class RedPaymentSlipData extends PaymentSlipData -{ - - /** - * Determines if the payment slip has an IBAN specified. Can be disabled for pre-printed payment slips - * Only possible for ES, but not for ESR - * - * @var bool - */ - protected $withIban = true; - - /** - * Determines if the payment slip has a payment reason. Can be disabled for pre-printed payment slips - * Only possible for ES, but not for ESR - * - * @var bool - */ - protected $withPaymentReason = true; - - /** - * The IBAN of the recipient of a ES. Not available on a ESR - * - * @var string - */ - protected $iban = ''; - - /** - * The first line of the payment reason of a ES. Not available on a ESR - * - * @var string - */ - protected $paymentReasonLine1 = ''; - - /** - * The second line of the payment reason of a ES. Not available on a ESR - * - * @var string - */ - protected $paymentReasonLine2 = ''; - - /** - * The third line of the payment reason of a ES. Not available on a ESR - * - * @var string - */ - protected $paymentReasonLine3 = ''; - - /** - * The fourth line of the payment reason of a ES. Not available on a ESR - * - * @var string - */ - protected $paymentReasonLine4 = ''; - - /** - * Set if payment slip has an IBAN specified - * - * Resets the IBAN when disabling. - * - * @param bool $withIban True if yes, false if no. - * @return $this The current instance for a fluent interface. - */ - public function setWithIban($withIban = true) - { - $this->isBool($withIban, 'withIban'); - $this->withIban = $withIban; - - if ($withIban === false) { - $this->iban = ''; - } - - return $this; - } - - /** - * Get if payment slip has an IBAN specified - * - * @return bool True if payment slip has an IBAN specified, else false. - */ - public function getWithIban() - { - return $this->withIban; - } - - /** - * Set if payment slip has a payment reason specified. - * - * Resets the payment reason data when disabling. - * - * @param bool $withPaymentReason True if yes, false if no. - * @return $this The current instance for a fluent interface. - */ - public function setWithPaymentReason($withPaymentReason = true) - { - $this->isBool($withPaymentReason, 'withPaymentReason'); - $this->withPaymentReason = $withPaymentReason; - - if ($withPaymentReason === false) { - $this->paymentReasonLine1 = ''; - $this->paymentReasonLine2 = ''; - $this->paymentReasonLine3 = ''; - $this->paymentReasonLine4 = ''; - } - - return $this; - } - - /** - * Get if payment slip has a payment reason specified - * - * @return bool True if payment slip has a payment reason specified, else false. - */ - public function getWithPaymentReason() - { - return $this->withPaymentReason; - } - - /** - * Set the IBAN - * - * @param string $iban The IBAN. - * @return $this The current instance for a fluent interface. - * @throws DisabledDataException If the data is disabled. - * - * @todo Consider stripping spaces (may be optionally) - * @todo Implement validation of the IBAN - * @link http://code.google.com/p/php-iban/ - * @link https://github.com/jschaedl/Iban - * @link http://www.ibancalculator.com/iban_validieren.html - */ - public function setIban($iban) - { - if (!$this->getWithIban()) { - throw new DisabledDataException('IBAN'); - } - $this->iban = $iban; - - return $this; - } - - /** - * Get the IBAN - * - * @return string The IBAN, if withIban is set to true. - * @throws DisabledDataException If the data is disabled. - */ - public function getIban() - { - if (!$this->getWithIban()) { - throw new DisabledDataException('IBAN'); - } - return $this->iban; - } - - /** - * Set payment reason lines - * - * @param string $paymentReasonLine1 The first line of the payment reason. - * @param string $paymentReasonLine2 The second line of the payment reason. - * @param string $paymentReasonLine3 The third line of the payment reason. - * @param string $paymentReasonLine4 The fourth line of the payment reason. - * @return $this The current instance for a fluent interface. - */ - public function setPaymentReasonData( - $paymentReasonLine1 = '', - $paymentReasonLine2 = '', - $paymentReasonLine3 = '', - $paymentReasonLine4 = '' - ) { - $this->setPaymentReasonLine1($paymentReasonLine1); - $this->setPaymentReasonLine2($paymentReasonLine2); - $this->setPaymentReasonLine3($paymentReasonLine3); - $this->setPaymentReasonLine4($paymentReasonLine4); - - return $this; - } - - /** - * Set the first line of the payment reason - * - * @param string $paymentReasonLine1 The first line of the payment reason. - * @return $this The current instance for a fluent interface. - * @throws DisabledDataException If the data is disabled. - */ - public function setPaymentReasonLine1($paymentReasonLine1) - { - if (!$this->getWithPaymentReason()) { - throw new DisabledDataException('payment reason line 1'); - } - $this->paymentReasonLine1 = $paymentReasonLine1; - - return $this; - } - - /** - * Get the first line of the payment reason - * - * @return string The first line of the payment reason, if withPaymentReason is set to true. - * @throws DisabledDataException If the data is disabled. - */ - public function getPaymentReasonLine1() - { - if (!$this->getWithPaymentReason()) { - throw new DisabledDataException('payment reason line 1'); - } - return $this->paymentReasonLine1; - } - - /** - * Set the second line of the payment reason - * - * @param string $paymentReasonLine2 The second line of the payment reason. - * @return $this The current instance for a fluent interface. - * @throws DisabledDataException If the data is disabled. - */ - public function setPaymentReasonLine2($paymentReasonLine2) - { - if (!$this->getWithPaymentReason()) { - throw new DisabledDataException('payment reason line 2'); - } - $this->paymentReasonLine2 = $paymentReasonLine2; - - return $this; - } - - /** - * Get the second line of the payment reason - * - * @return string The second line of the payment reason, if withPaymentReason is set to true. - * @throws DisabledDataException If the data is disabled. - */ - public function getPaymentReasonLine2() - { - if (!$this->getWithPaymentReason()) { - throw new DisabledDataException('payment reason line 2'); - } - return $this->paymentReasonLine2; - } - - /** - * Set the third line of the payment reason - * - * @param string $paymentReasonLine3 The third line of the payment reason. - * @return $this The current instance for a fluent interface. - * @throws DisabledDataException If the data is disabled. - */ - public function setPaymentReasonLine3($paymentReasonLine3) - { - if (!$this->getWithPaymentReason()) { - throw new DisabledDataException('payment reason line 3'); - } - $this->paymentReasonLine3 = $paymentReasonLine3; - - return $this; - } - - /** - * Get the third line of the payment reason - * - * @return string The third line of the payment reason, if withPaymentReason is set to true. - * @throws DisabledDataException If the data is disabled. - */ - public function getPaymentReasonLine3() - { - if (!$this->getWithPaymentReason()) { - throw new DisabledDataException('payment reason line 3'); - } - return $this->paymentReasonLine3; - } - - /** - * Set the fourth line of the payment reason - * - * @param string $paymentReasonLine4 The fourth line of the payment reason. - * @return $this The current instance for a fluent interface. - * @throws DisabledDataException If the data is disabled. - */ - public function setPaymentReasonLine4($paymentReasonLine4) - { - if (!$this->getWithPaymentReason()) { - throw new DisabledDataException('payment reason line 4'); - } - $this->paymentReasonLine4 = $paymentReasonLine4; - - return $this; - } - - /** - * Get the fourth line of the payment reason - * - * @return string The fourth line of the payment reason, if withPaymentReason is set to true. - * @throws DisabledDataException If the data is disabled. - */ - public function getPaymentReasonLine4() - { - if (!$this->getWithPaymentReason()) { - throw new DisabledDataException('payment reason line 4'); - } - return $this->paymentReasonLine4; - } - - /** - * Set payment slip for not to be used for payment - * - * XXXes out all fields to prevent people using the payment slip. - * - * @param boolean $notForPayment True if not for payment, else false. - * @return $this The current instance for a fluent interface. - */ - public function setNotForPayment($notForPayment = true) - { - parent::setNotForPayment($notForPayment); - - if ($notForPayment === true) { - if ($this->getWithPaymentReason() === true) { - $this->setPaymentReasonData('XXXXXX', 'XXXXXX', 'XXXXXX', 'XXXXXX'); - } - if ($this->getWithIban() === true) { - $this->setIban('XXXXXXXXXXXXXXXXXXXXX'); - } - } - - return $this; - } - - /** - * Get the IBAN number in human readable format - * - * Not valid for electronic transactions. - * - * @return string Formatted IBAN, if withIban is set to true. - * @link http://en.wikipedia.org/wiki/International_Bank_Account_Number#Practicalities - */ - public function getFormattedIban() - { - $iban = $this->getIban(); - return $this->breakStringIntoBlocks($iban, 4, false); - - } -} diff --git a/src/Resources/img/ezs_red.gif b/src/Resources/img/ezs_red.gif deleted file mode 100644 index cd7699d..0000000 Binary files a/src/Resources/img/ezs_red.gif and /dev/null differ diff --git a/tests/RedPaymentSlipDataTest.php b/tests/RedPaymentSlipDataTest.php deleted file mode 100644 index 15b0d83..0000000 --- a/tests/RedPaymentSlipDataTest.php +++ /dev/null @@ -1,340 +0,0 @@ - - * @author Peter Siska - * @link https://github.com/ravage84/SwissPaymentSlip/ - */ - -namespace SwissPaymentSlip\SwissPaymentSlip\Tests; - -use SwissPaymentSlip\SwissPaymentSlip\RedPaymentSlipData; - -/** - * Tests for the RedPaymentSlipData class - * - * @coversDefaultClass SwissPaymentSlip\SwissPaymentSlip\RedPaymentSlipData - */ -class RedPaymentSlipDataTest extends \PHPUnit_Framework_TestCase -{ - /** - * The object under test - * - * @var RedPaymentSlipData - */ - protected $slipData; - - /** - * Setup the object under test - * - * @return void - */ - protected function setUp() - { - $this->slipData = new RedPaymentSlipData(); - } - - /** - * Tests the getWithIban and setWithIban methods - * - * @return void - * @covers ::setWithIban - * @covers ::getWithIban - * @covers ::isBool - * @covers ::setIban - * @covers ::getIban - */ - public function testSetWithIban() - { - // Test default values - $this->assertEquals('', $this->slipData->getIban()); - $this->assertTrue($this->slipData->getWithIban()); - - // Set data when enabled, also check for returned instance - $returned = $this->slipData->setIban('CH380123456789'); - $this->assertInstanceOf('SwissPaymentSlip\SwissPaymentSlip\RedPaymentSlipData', $returned); - $this->assertEquals('CH380123456789', $this->slipData->getIban()); - - // Disable feature, also check for returned instance - $returned = $this->slipData->setWithIban(false); - $this->assertInstanceOf('SwissPaymentSlip\SwissPaymentSlip\RedPaymentSlipData', $returned); - $this->assertFalse($this->slipData->getWithIban()); - - // Re-enable feature, using no parameter - $this->slipData->setWithIban(); - $this->assertTrue($this->slipData->getWithIban()); - $this->assertEquals('', $this->slipData->getIban()); - } - - /** - * Tests the setIban method when disabled - * - * @return void - * @expectedException \SwissPaymentSlip\SwissPaymentSlip\Exception\DisabledDataException - * @expectedExceptionMessage You are accessing the disabled IBAN. You need to re-enable it first. - * @covers ::setIban - */ - public function testSetIbanWhenDisabled() - { - $this->slipData->setWithIban(false); - $this->slipData->setIban(''); - } - - /** - * Tests the getIban method when disabled - * - * @return void - * @expectedException \SwissPaymentSlip\SwissPaymentSlip\Exception\DisabledDataException - * @expectedExceptionMessage You are accessing the disabled IBAN. You need to re-enable it first. - * @covers ::getIban - */ - public function testGetIbanWhenDisabled() - { - $this->slipData->setWithIban(false); - $this->slipData->getIban(); - } - - /** - * Tests the setWithIban method with an invalid parameter - * - * @return void - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage $withIban is not a boolean. - * @covers ::setWithIban - * @covers ::isBool - */ - public function testSetWithIbanInvalidParameter() - { - $this->slipData->setWithIban(1); - } - - /** - * Tests the getWithPaymentReason and setWithPaymentReason methods - * - * @return void - * @covers ::setWithPaymentReason - * @covers ::getWithPaymentReason - * @covers ::isBool - * @covers ::setPaymentReasonData - * @covers ::setPaymentReasonLine1 - * @covers ::setPaymentReasonLine2 - * @covers ::setPaymentReasonLine3 - * @covers ::setPaymentReasonLine4 - * @covers ::getPaymentReasonLine1 - * @covers ::getPaymentReasonLine2 - * @covers ::getPaymentReasonLine3 - * @covers ::getPaymentReasonLine4 - */ - public function testSetWithPaymentReason() - { - // Test default values - $this->assertEquals('', $this->slipData->getPaymentReasonLine1()); - $this->assertEquals('', $this->slipData->getPaymentReasonLine2()); - $this->assertEquals('', $this->slipData->getPaymentReasonLine3()); - $this->assertEquals('', $this->slipData->getPaymentReasonLine4()); - $this->assertTrue($this->slipData->getWithPaymentReason()); - - // Set data when enabled, also check for returned instance - $returned = $this->slipData->setPaymentReasonData('AAAAAAAAAA', 'BBBBBBBBBB', 'CCCCCCCCCC', 'DDDDDDDDDD'); - $this->assertInstanceOf('SwissPaymentSlip\SwissPaymentSlip\RedPaymentSlipData', $returned); - $this->assertEquals('AAAAAAAAAA', $this->slipData->getPaymentReasonLine1()); - $this->assertEquals('BBBBBBBBBB', $this->slipData->getPaymentReasonLine2()); - $this->assertEquals('CCCCCCCCCC', $this->slipData->getPaymentReasonLine3()); - $this->assertEquals('DDDDDDDDDD', $this->slipData->getPaymentReasonLine4()); - - // Disable feature, also check for returned instance - $returned = $this->slipData->setWithPaymentReason(false); - $this->assertInstanceOf('SwissPaymentSlip\SwissPaymentSlip\RedPaymentSlipData', $returned); - $this->assertFalse($this->slipData->getWithPaymentReason()); - - // Re-enable feature, using no parameter - $this->slipData->setWithPaymentReason(); - $this->assertTrue($this->slipData->getWithPaymentReason()); - $this->assertEquals('', $this->slipData->getPaymentReasonLine1()); - $this->assertEquals('', $this->slipData->getPaymentReasonLine2()); - $this->assertEquals('', $this->slipData->getPaymentReasonLine3()); - $this->assertEquals('', $this->slipData->getPaymentReasonLine4()); - } - - /** - * Tests the setPaymentReasonLine1 method when disabled - * - * @return void - * @expectedException \SwissPaymentSlip\SwissPaymentSlip\Exception\DisabledDataException - * @expectedExceptionMessage You are accessing the disabled payment reason line 1. You need to re-enable it first. - * @covers ::setPaymentReasonLine1 - */ - public function testSetPaymentReasonLine1WhenDisabled() - { - $this->slipData->setWithPaymentReason(false); - $this->slipData->setPaymentReasonLine1(''); - } - - /** - * Tests the getPaymentReasonLine1 method when disabled - * - * @return void - * @expectedException \SwissPaymentSlip\SwissPaymentSlip\Exception\DisabledDataException - * @expectedExceptionMessage You are accessing the disabled payment reason line 1. You need to re-enable it first. - * @covers ::getPaymentReasonLine1 - */ - public function testGetPaymentReasonLine1WhenDisabled() - { - $this->slipData->setWithPaymentReason(false); - $this->slipData->getPaymentReasonLine1(); - } - - /** - * Tests the setPaymentReasonLine2 method when disabled - * - * @return void - * @expectedException \SwissPaymentSlip\SwissPaymentSlip\Exception\DisabledDataException - * @expectedExceptionMessage You are accessing the disabled payment reason line 2. You need to re-enable it first. - * @covers ::setPaymentReasonLine2 - */ - public function testSetPaymentReasonLine2WhenDisabled() - { - $this->slipData->setWithPaymentReason(false); - $this->slipData->setPaymentReasonLine2(''); - } - - /** - * Tests the getPaymentReasonLine2 method when disabled - * - * @return void - * @expectedException \SwissPaymentSlip\SwissPaymentSlip\Exception\DisabledDataException - * @expectedExceptionMessage You are accessing the disabled payment reason line 2. You need to re-enable it first. - * @covers ::getPaymentReasonLine2 - */ - public function testGetPaymentReasonLine2WhenDisabled() - { - $this->slipData->setWithPaymentReason(false); - $this->slipData->getPaymentReasonLine2(); - } - - /** - * Tests the setPaymentReasonLine3 method when disabled - * - * @return void - * @expectedException \SwissPaymentSlip\SwissPaymentSlip\Exception\DisabledDataException - * @expectedExceptionMessage You are accessing the disabled payment reason line 3. You need to re-enable it first. - * @covers ::setPaymentReasonLine3 - */ - public function testSetPaymentReasonLine3WhenDisabled() - { - $this->slipData->setWithPaymentReason(false); - $this->slipData->setPaymentReasonLine3(''); - } - - /** - * Tests the getPaymentReasonLine3 method when disabled - * - * @return void - * @expectedException \SwissPaymentSlip\SwissPaymentSlip\Exception\DisabledDataException - * @expectedExceptionMessage You are accessing the disabled payment reason line 3. You need to re-enable it first. - * @covers ::getPaymentReasonLine3 - */ - public function testGetPaymentReasonLine3WhenDisabled() - { - $this->slipData->setWithPaymentReason(false); - $this->slipData->getPaymentReasonLine3(); - } - - /** - * Tests the setPaymentReasonLine4 method when disabled - * - * @return void - * @expectedException \SwissPaymentSlip\SwissPaymentSlip\Exception\DisabledDataException - * @expectedExceptionMessage You are accessing the disabled payment reason line 4. You need to re-enable it first. - * @covers ::setPaymentReasonLine4 - */ - public function testSetPaymentReasonLine4WhenDisabled() - { - $this->slipData->setWithPaymentReason(false); - $this->slipData->setPaymentReasonLine4(''); - } - - /** - * Tests the getPaymentReasonLine4 method when disabled - * - * @return void - * @expectedException \SwissPaymentSlip\SwissPaymentSlip\Exception\DisabledDataException - * @expectedExceptionMessage You are accessing the disabled payment reason line 4. You need to re-enable it first. - * @covers ::getPaymentReasonLine4 - */ - public function testGetPaymentReasonLine4WhenDisabled() - { - $this->slipData->setWithPaymentReason(false); - $this->slipData->getPaymentReasonLine4(); - } - - /** - * Tests the setWithPaymentReason method with an invalid parameter - * - * @return void - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage $withPaymentReason is not a boolean. - * @covers ::setWithPaymentReason - * @covers ::isBool - */ - public function testSetWithPaymentReasonInvalidParameter() - { - $this->slipData->setWithPaymentReason(1); - } - - /** - * Tsets the getFormattedIban method - * - * @return void - * @covers ::getFormattedIban - */ - public function testGetFormattedIban() - { - $this->slipData->setIban('CH3808888123456789012'); - - $this->assertEquals('CH3808888123456789012', $this->slipData->getIban()); - $this->assertEquals('CH38 0888 8123 4567 8901 2', $this->slipData->getFormattedIban()); - } - - /** - * Tests the setNotForPayment method - * - * @return void - * @covers ::setNotForPayment - * @covers ::getNotForPayment - * @covers ::getFormattedIban - */ - public function testSetNotForPayment() - { - $returned = $this->slipData->setNotForPayment(true); - $this->assertInstanceOf('SwissPaymentSlip\SwissPaymentSlip\RedPaymentSlipData', $returned); - $this->assertTrue($this->slipData->getNotForPayment()); - - $this->assertEquals('XXXXXXXXXXXXXXXXXXXXX', $this->slipData->getIban()); - - $this->assertEquals('XXXXXX', $this->slipData->getPayerLine1()); - $this->assertEquals('XXXXXX', $this->slipData->getPayerLine2()); - $this->assertEquals('XXXXXX', $this->slipData->getPayerLine3()); - $this->assertEquals('XXXXXX', $this->slipData->getPayerLine4()); - - $this->assertEquals('XXXX XXXX XXXX XXXX XXXX X', $this->slipData->getFormattedIban()); - } - - /** - * Tests the setNotForPayment method when fields are disabled - * - * @return void - * @covers ::setNotForPayment - */ - public function testSetNotForPaymentDisabledFields() - { - $this->slipData->setWithPaymentReason(false); - $this->slipData->setWithIban(false); - - $this->slipData->setNotForPayment(true); - } -} diff --git a/tests/RedPaymentSlipTest.php b/tests/RedPaymentSlipTest.php deleted file mode 100644 index c19bf97..0000000 --- a/tests/RedPaymentSlipTest.php +++ /dev/null @@ -1,342 +0,0 @@ - - * @author Peter Siska - * @link https://github.com/ravage84/SwissPaymentSlip/ - */ - -namespace SwissPaymentSlip\SwissPaymentSlip\Tests; - -use SwissPaymentSlip\SwissPaymentSlip\RedPaymentSlip; -use SwissPaymentSlip\SwissPaymentSlip\RedPaymentSlipData; - -/** - * Tests for the RedPaymentSlip class - * - * @coversDefaultClass SwissPaymentSlip\SwissPaymentSlip\RedPaymentSlip - */ -class RedPaymentSlipTest extends PaymentSlipTestCase -{ - /** - * The object under test - * - * @var RedPaymentSlip - */ - protected $paymentSlip; - - /** - * Setup a slip to test and some default and set attributes to test - * - * @return void - */ - protected function setUp() - { - $slipData = new RedPaymentSlipData(); - $this->paymentSlip = new RedPaymentSlip($slipData); - - $attributes = array(); - $attributes['PosX'] = 0; - $attributes['PosY'] = 0; - $attributes['Width'] = 0; - $attributes['Height'] = 0; - $attributes['Background'] = 'transparent'; - $attributes['FontFamily'] = 'Helvetica'; - $attributes['FontSize'] = '10'; - $attributes['FontColor'] = '#000'; - $attributes['LineHeight'] = 4; - $attributes['TextAlign'] = 'L'; - - $this->defaultAttributes = $attributes; - - $attributes = array(); - $attributes['PosX'] = 123; - $attributes['PosY'] = 456; - $attributes['Width'] = 987; - $attributes['Height'] = 654; - $attributes['Background'] = '#123456'; - $attributes['FontFamily'] = 'Courier'; - $attributes['FontSize'] = '1'; - $attributes['FontColor'] = '#654321'; - $attributes['LineHeight'] = '15'; - $attributes['TextAlign'] = 'C'; - - $this->setAttributes = $attributes; - } - - /** - * Tests the getPaymentSlipData method - * - * @return void - * @covers ::getPaymentSlipData - */ - public function testGetPaymentSlipDataIsInstanceOf() - { - $this->assertInstanceOf( - 'SwissPaymentSlip\SwissPaymentSlip\RedPaymentSlipData', - $this->paymentSlip->getPaymentSlipData() - ); - } - - /** - * Tests the default background - * - * @return void - * @covers ::setDefaults - */ - public function testSlipBackgroundDefaultValues() - { - $this->assertEquals('ezs_red.gif', basename($this->paymentSlip->getSlipBackground())); - } - - /** - * Tests the default attributes of the payment reason element - * - * @return void - * @covers ::setDefaults - * @todo Implement once the defaults are set properly in RedPaymentSlip::setDefaults() - */ - public function testPaymentReasonAttrDefaultValues() - { - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * Tests the default attributes of the left IBAN element - * - * @return void - * @covers ::setDefaults - * @todo Implement once the defaults are set properly in RedPaymentSlip::setDefaults() - */ - public function testIbanLeftAttrDefaultValues() - { - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * Tests the default attributes of the right IBAN element - * - * @return void - * @covers ::setDefaults - * @todo Implement once the defaults are set properly in RedPaymentSlip::setDefaults() - */ - public function testIbanRightAttrDefaultValues() - { - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - - /** - * Tests the setPaymentReasonAttr method - * - * @return void - * @covers ::setPaymentReasonAttr - * @covers ::setAttributes - * @covers ::getPaymentReasonAttr - */ - public function testSetPaymentReasonAttr() - { - $returned = $this->paymentSlip->setPaymentReasonAttr(123, 456, 987, 654, '#123456', 'Courier', '1', '#654321', '15', 'C'); - $this->assertInstanceOf('SwissPaymentSlip\SwissPaymentSlip\RedPaymentSlip', $returned); - $this->assertEquals($this->setAttributes, $this->paymentSlip->getPaymentReasonAttr()); - } - - /** - * Tests the setIbanLeftAttr method - * - * @return void - * @covers ::setIbanLeftAttr - * @covers ::setAttributes - * @covers ::getIbanLeftAttr - */ - public function testSetIbanLeftAttr() - { - $returned = $this->paymentSlip->setIbanLeftAttr(123, 456, 987, 654, '#123456', 'Courier', '1', '#654321', '15', 'C'); - $this->assertInstanceOf('SwissPaymentSlip\SwissPaymentSlip\RedPaymentSlip', $returned); - $this->assertEquals($this->setAttributes, $this->paymentSlip->getIbanLeftAttr()); - } - - /** - * Tests the setIbanRightAttr method - * - * @return void - * @covers ::setIbanRightAttr - * @covers ::setAttributes - * @covers ::getIbanRightAttr - */ - public function testSetIbanRightAttr() - { - $returned = $this->paymentSlip->setIbanRightAttr(123, 456, 987, 654, '#123456', 'Courier', '1', '#654321', '15', 'C'); - $this->assertInstanceOf('SwissPaymentSlip\SwissPaymentSlip\RedPaymentSlip', $returned); - $this->assertEquals($this->setAttributes, $this->paymentSlip->getIbanRightAttr()); - } - - /** - * Tests the setDisplayIban method - * - * @return void - * @covers ::setDisplayIban - * @covers ::getDisplayIban - * @covers ::isBool - */ - public function testSetDisplayIban() - { - // Test the default value - $this->assertTrue($this->paymentSlip->getDisplayIban()); - - // Disable the feature, also assert returned instance - $returned = $this->paymentSlip->setDisplayIban(false); - $this->assertInstanceOf('SwissPaymentSlip\SwissPaymentSlip\RedPaymentSlip', $returned); - $this->assertFalse($this->paymentSlip->getDisplayIban()); - - // Re-enable the feature - $this->paymentSlip->setDisplayIban(); - $this->assertTrue($this->paymentSlip->getDisplayIban()); - - // Check if the data is disabled - $this->paymentSlip->getPaymentSlipData()->setWithIban(false); - $this->assertFalse($this->paymentSlip->getDisplayIban()); - } - - /** - * Tests the setDisplayIban method with an invalid parameter - * - * @return void - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage $displayIban is not a boolean. - * @covers ::setDisplayIban - * @covers ::isBool - */ - public function testSetDisplayIbanInvalidParameter() - { - $this->paymentSlip->setDisplayIban('true'); - } - - /** - * Tests the setDisplayPaymentReason method - * - * @return void - * @covers ::setDisplayPaymentReason - * @covers ::getDisplayPaymentReason - * @covers ::isBool - */ - public function testSetDisplayPaymentReason() - { - // Test the default value - $this->assertTrue($this->paymentSlip->getDisplayPaymentReason()); - - // Disable the feature, also assert returned instance - $returned = $this->paymentSlip->setDisplayPaymentReason(false); - $this->assertInstanceOf('SwissPaymentSlip\SwissPaymentSlip\RedPaymentSlip', $returned); - $this->assertFalse($this->paymentSlip->getDisplayPaymentReason()); - - // Re-enable the feature - $this->paymentSlip->setDisplayPaymentReason(); - $this->assertTrue($this->paymentSlip->getDisplayPaymentReason()); - - // Check if the data is disabled - $this->paymentSlip->getPaymentSlipData()->setWithPaymentReason(false); - $this->assertFalse($this->paymentSlip->getDisplayPaymentReason()); - } - - /** - * Tests the setDisplayPaymentReason method with an invalid parameter - * - * @return void - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage $displayPaymentReason is not a boolean. - * @covers ::setDisplayPaymentReason - * @covers ::isBool - */ - public function testSetDisplayPaymentReasonInvalidParameter() - { - $this->paymentSlip->setDisplayPaymentReason('true'); - } - - /** - * Tests the getAllElements method - * - * @return void - * @covers ::getAllElements - */ - public function testGetAllElements() - { - $elements = $this->paymentSlip->getAllElements(); - - $expectedElements = array( - 'bankLeft', - 'bankRight', - 'recipientLeft', - 'recipientRight', - 'accountLeft', - 'accountRight', - 'amountFrancsLeft', - 'amountFrancsRight', - 'amountCentsLeft', - 'amountCentsRight', - 'payerLeft', - 'payerRight', - 'IbanLeft', - 'IbanRight', - 'paymentReason', - ); - - $this->assertElementsArray($expectedElements, $elements); - } - - /** - * Tests the getAllElements method when no elements are shown - * - * @return void - * @covers ::getAllElements - */ - public function testGetAllElementsNoElementsShown() - { - $this->paymentSlip->setDisplayAccount(false); - $this->paymentSlip->setDisplayAmount(false); - $this->paymentSlip->setDisplayBank(false); - $this->paymentSlip->setDisplayPayer(false); - $this->paymentSlip->setDisplayRecipient(false); - $this->paymentSlip->setDisplayIban(false); - $this->paymentSlip->setDisplayPaymentReason(false); - - $elements = $this->paymentSlip->getAllElements(); - - $expectedElements = array(); - - $this->assertElementsArray($expectedElements, $elements); - } - - /** - * Tests the getAllElements method when all data is disabled - * - * @return void - * @covers ::getAllElements - */ - public function testGetAllElementsDisabledData() - { - $paymentSlipData = $this->paymentSlip->getPaymentSlipData(); - $paymentSlipData->setWithAccountNumber(false); - $paymentSlipData->setWithAmount(false); - $paymentSlipData->setWithBank(false); - $paymentSlipData->setWithPayer(false); - $paymentSlipData->setWithRecipient(false); - $paymentSlipData->setWithPaymentReason(false); - $paymentSlipData->setWithIban(false); - - $elements = $this->paymentSlip->getAllElements(); - - $expectedElements = array(); - - $this->assertElementsArray($expectedElements, $elements); - } -}