From f7872ebd1b1de02b202a75329923a8cc45976ac5 Mon Sep 17 00:00:00 2001 From: Thiago Paes Date: Sun, 2 Dec 2018 01:22:56 -0200 Subject: [PATCH 1/2] feature(shipment-common): Using ShipmentCommon package, removing external validator --- composer.json | 4 +- composer.lock | 175 +++----- phpunit.xml.dist | 8 +- src/Common/Base/Address.php | 215 ---------- src/Common/Base/Authorization.php | 40 -- src/Common/Base/Bank.php | 118 ------ src/Common/Base/BankAccount.php | 174 -------- src/Common/Base/Billet.php | 134 ------- src/Common/Base/Cart.php | 32 -- src/Common/Base/Charge.php | 124 ------ src/Common/Base/Client.php | 51 --- src/Common/Base/ConsumerUnity.php | 147 ------- src/Common/Base/CreditCard.php | 168 -------- src/Common/Base/Customer.php | 136 ------- src/Common/Base/Dealership.php | 71 ---- src/Common/Base/Document.php | 95 ----- src/Common/Base/Email.php | 90 ----- src/Common/Base/Holder.php | 45 --- src/Common/Base/Occurrence.php | 143 ------- src/Common/Base/Parcel.php | 139 ------- src/Common/Base/Parcels.php | 31 -- src/Common/Base/Person.php | 299 -------------- src/Common/Base/Phone.php | 87 ---- src/Common/Base/Purchaser.php | 79 ---- src/Common/Base/Seller.php | 43 -- src/Common/Base/Sequence.php | 59 --- src/Common/Type/Alphanumeric.php | 13 - src/Common/Type/Number.php | 13 - src/Common/Util/Number.php | 38 -- src/Factory.php | 48 +-- src/Received/File.php | 14 +- src/Received/Partial/Detail.php | 18 +- src/Received/Partial/Footer.php | 2 +- src/Received/Partial/Header.php | 4 +- src/Shipment/File.php | 26 +- src/Shipment/Partial/Detail.php | 18 +- src/Shipment/Partial/Footer.php | 2 +- src/Shipment/Partial/Header.php | 4 +- .../ChangeProtectedAttribute.php | 2 +- tests/Common/Base/AddressTest.php | 325 --------------- tests/Common/Base/AuthorizationTest.php | 66 ---- tests/Common/Base/BankAccountTest.php | 235 ----------- tests/Common/Base/BankTest.php | 148 ------- tests/Common/Base/BilletTest.php | 193 --------- tests/Common/Base/CartTest.php | 83 ---- tests/Common/Base/ChargeTest.php | 97 ----- tests/Common/Base/ClientTest.php | 78 ---- tests/Common/Base/ConsumerUnityTest.php | 161 -------- tests/Common/Base/CreditCardTest.php | 211 ---------- tests/Common/Base/CustomerTest.php | 233 ----------- tests/Common/Base/DealershipTest.php | 100 ----- tests/Common/Base/DocumentTest.php | 128 ------ tests/Common/Base/EmailTest.php | 135 ------- tests/Common/Base/HolderTest.php | 92 ----- tests/Common/Base/OccurrenceTest.php | 226 ----------- tests/Common/Base/ParcelTest.php | 179 --------- tests/Common/Base/ParcelsTest.php | 54 --- tests/Common/Base/PersonTest.php | 374 ------------------ tests/Common/Base/PhoneTest.php | 138 ------- tests/Common/Base/PurchaserTest.php | 114 ------ tests/Common/Base/SellerTest.php | 74 ---- tests/Common/Base/SequenceTest.php | 78 ---- tests/Common/Util/NumberTest.php | 77 ---- tests/Mock.php | 42 +- tests/Received/FileTest.php | 4 +- tests/Received/Partial/DetailTest.php | 2 +- tests/Received/Partial/FooterTest.php | 2 +- tests/Received/Partial/HeaderTest.php | 2 +- tests/Shipment/FileTest.php | 4 +- tests/Shipment/Partial/DetailTest.php | 2 +- tests/Shipment/Partial/FooterTest.php | 2 +- tests/Shipment/Partial/HeaderTest.php | 2 +- 72 files changed, 158 insertions(+), 6412 deletions(-) delete mode 100644 src/Common/Base/Address.php delete mode 100644 src/Common/Base/Authorization.php delete mode 100644 src/Common/Base/Bank.php delete mode 100644 src/Common/Base/BankAccount.php delete mode 100644 src/Common/Base/Billet.php delete mode 100644 src/Common/Base/Cart.php delete mode 100644 src/Common/Base/Charge.php delete mode 100644 src/Common/Base/Client.php delete mode 100644 src/Common/Base/ConsumerUnity.php delete mode 100644 src/Common/Base/CreditCard.php delete mode 100644 src/Common/Base/Customer.php delete mode 100644 src/Common/Base/Dealership.php delete mode 100644 src/Common/Base/Document.php delete mode 100644 src/Common/Base/Email.php delete mode 100644 src/Common/Base/Holder.php delete mode 100644 src/Common/Base/Occurrence.php delete mode 100644 src/Common/Base/Parcel.php delete mode 100644 src/Common/Base/Parcels.php delete mode 100644 src/Common/Base/Person.php delete mode 100644 src/Common/Base/Phone.php delete mode 100644 src/Common/Base/Purchaser.php delete mode 100644 src/Common/Base/Seller.php delete mode 100644 src/Common/Base/Sequence.php delete mode 100644 src/Common/Type/Alphanumeric.php delete mode 100644 src/Common/Type/Number.php delete mode 100755 src/Common/Util/Number.php rename {src/Common/Util => tests}/ChangeProtectedAttribute.php (91%) delete mode 100644 tests/Common/Base/AddressTest.php delete mode 100644 tests/Common/Base/AuthorizationTest.php delete mode 100644 tests/Common/Base/BankAccountTest.php delete mode 100644 tests/Common/Base/BankTest.php delete mode 100644 tests/Common/Base/BilletTest.php delete mode 100644 tests/Common/Base/CartTest.php delete mode 100644 tests/Common/Base/ChargeTest.php delete mode 100644 tests/Common/Base/ClientTest.php delete mode 100644 tests/Common/Base/ConsumerUnityTest.php delete mode 100644 tests/Common/Base/CreditCardTest.php delete mode 100644 tests/Common/Base/CustomerTest.php delete mode 100644 tests/Common/Base/DealershipTest.php delete mode 100644 tests/Common/Base/DocumentTest.php delete mode 100644 tests/Common/Base/EmailTest.php delete mode 100644 tests/Common/Base/HolderTest.php delete mode 100644 tests/Common/Base/OccurrenceTest.php delete mode 100644 tests/Common/Base/ParcelTest.php delete mode 100644 tests/Common/Base/ParcelsTest.php delete mode 100644 tests/Common/Base/PersonTest.php delete mode 100644 tests/Common/Base/PhoneTest.php delete mode 100644 tests/Common/Base/PurchaserTest.php delete mode 100644 tests/Common/Base/SellerTest.php delete mode 100644 tests/Common/Base/SequenceTest.php delete mode 100644 tests/Common/Util/NumberTest.php diff --git a/composer.json b/composer.json index 04c7ea1..6030bec 100644 --- a/composer.json +++ b/composer.json @@ -38,8 +38,8 @@ ], "require": { "php" : "^7.1", - "respect/validation" : "^1.1.12", - "andersondanilo/cnab_php" : "~1.3.10" + "andersondanilo/cnab_php" : "~1.3.10", + "mrprompt/shipmentcommon" : "dev-master" }, "require-dev": { "phpunit/phpunit": "^6.1.3", diff --git a/composer.lock b/composer.lock index 7097b91..b2122d1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1c8dd06dd5afc504b86c2ec6c21bdd06", + "content-hash": "7f2c34001ad4f65ad2281e3e924c3476", "packages": [ { "name": "andersondanilo/cnab_php", @@ -103,173 +103,107 @@ "time": "2018-07-30T17:28:13+00:00" }, { - "name": "mustangostang/spyc", - "version": "0.5.1", - "source": { - "type": "git", - "url": "https://github.com/mustangostang/spyc.git", - "reference": "dc4785b4d7227fd9905e086d499fb8abfadf9977" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/mustangostang/spyc/zipball/dc4785b4d7227fd9905e086d499fb8abfadf9977", - "reference": "dc4785b4d7227fd9905e086d499fb8abfadf9977", - "shasum": "" - }, - "require": { - "php": ">=5.3.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.5.x-dev" - } - }, - "autoload": { - "files": [ - "Spyc.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT License" - ], - "authors": [ - { - "name": "mustangostang", - "email": "vlad.andersen@gmail.com" - } - ], - "description": "A simple YAML loader/dumper class for PHP", - "homepage": "https://github.com/mustangostang/spyc/", - "keywords": [ - "spyc", - "yaml", - "yml" - ], - "time": "2013-02-21T10:52:01+00:00" - }, - { - "name": "respect/validation", - "version": "1.1.29", + "name": "mrprompt/shipmentcommon", + "version": "dev-master", "source": { "type": "git", - "url": "https://github.com/Respect/Validation.git", - "reference": "f8c90fa36859ca41c766efcf0c476d58913a7767" + "url": "https://github.com/mrprompt/ShipmentCommon.git", + "reference": "a49358f8a7c28642dab7609d42923f9780b6ea74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Respect/Validation/zipball/f8c90fa36859ca41c766efcf0c476d58913a7767", - "reference": "f8c90fa36859ca41c766efcf0c476d58913a7767", + "url": "https://api.github.com/repos/mrprompt/ShipmentCommon/zipball/a49358f8a7c28642dab7609d42923f9780b6ea74", + "reference": "a49358f8a7c28642dab7609d42923f9780b6ea74", "shasum": "" }, "require": { - "php": ">=5.4", - "symfony/polyfill-mbstring": "^1.2" + "php": "^7.1" }, "require-dev": { - "egulias/email-validator": "~1.2 || ~2.1", - "mikey179/vfsstream": "^1.5", - "phpunit/phpunit": "~4.0", - "symfony/validator": "~2.6.9", - "zendframework/zend-validator": "~2.3" - }, - "suggest": { - "egulias/email-validator": "Strict (RFC compliant) email validation", - "ext-bcmath": "Arbitrary Precision Mathematics", - "ext-mbstring": "Multibyte String Functions", - "friendsofphp/php-cs-fixer": "Fix PSR2 and other coding style issues", - "symfony/validator": "Use Symfony validator through Respect\\Validation", - "zendframework/zend-validator": "Use Zend Framework validator through Respect\\Validation" + "mockery/mockery": "dev-master@dev", + "phpunit/phpunit": "^6.1.3" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, "autoload": { "psr-4": { - "Respect\\Validation\\": "library/" + "MrPrompt\\ShipmentCommon\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "GPL-3.0-or-later" ], "authors": [ { - "name": "Respect/Validation Contributors", - "homepage": "https://github.com/Respect/Validation/graphs/contributors" + "name": "Thiago Paes", + "email": "mrprompt@gmail.com", + "role": "Developer" + }, + { + "name": "Johnathan Cardoso", + "email": "git@spamhunter.johnathan.com.br", + "role": "Collaborator" + }, + { + "name": "Walter Discher Cechinel", + "email": "mistrim@gmail.com", + "role": "Collaborator" + }, + { + "name": "Luís Otávio Cobucci Oblonczyk", + "email": "lcobucci@gmail.com", + "role": "Collaborator" } ], - "description": "The most awesome validation engine ever created for PHP", - "homepage": "http://respect.github.io/Validation/", - "keywords": [ - "respect", - "validation", - "validator" - ], - "time": "2018-11-04T21:58:45+00:00" + "description": "Common classes used in remittance libraries.", + "time": "2018-12-02T03:18:21+00:00" }, { - "name": "symfony/polyfill-mbstring", - "version": "v1.10.0", + "name": "mustangostang/spyc", + "version": "0.5.1", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "c79c051f5b3a46be09205c73b80b346e4153e494" + "url": "https://github.com/mustangostang/spyc.git", + "reference": "dc4785b4d7227fd9905e086d499fb8abfadf9977" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494", - "reference": "c79c051f5b3a46be09205c73b80b346e4153e494", + "url": "https://api.github.com/repos/mustangostang/spyc/zipball/dc4785b4d7227fd9905e086d499fb8abfadf9977", + "reference": "dc4785b4d7227fd9905e086d499fb8abfadf9977", "shasum": "" }, "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" + "php": ">=5.3.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.9-dev" + "dev-master": "0.5.x-dev" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, "files": [ - "bootstrap.php" + "Spyc.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "MIT License" ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "mustangostang", + "email": "vlad.andersen@gmail.com" } ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", + "description": "A simple YAML loader/dumper class for PHP", + "homepage": "https://github.com/mustangostang/spyc/", "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" + "spyc", + "yaml", + "yml" ], - "time": "2018-09-21T13:07:52+00:00" + "time": "2013-02-21T10:52:01+00:00" } ], "packages-dev": [ @@ -427,12 +361,12 @@ "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "a0299757e37696d3e18a61b0369d5d4fe09fc946" + "reference": "e269741a9e96f7a6257054ff963fc2b6316cf21a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/a0299757e37696d3e18a61b0369d5d4fe09fc946", - "reference": "a0299757e37696d3e18a61b0369d5d4fe09fc946", + "url": "https://api.github.com/repos/mockery/mockery/zipball/e269741a9e96f7a6257054ff963fc2b6316cf21a", + "reference": "e269741a9e96f7a6257054ff963fc2b6316cf21a", "shasum": "" }, "require": { @@ -484,7 +418,7 @@ "test double", "testing" ], - "time": "2018-10-12T09:41:15+00:00" + "time": "2018-11-22T06:31:11+00:00" }, { "name": "myclabs/deep-copy", @@ -1896,6 +1830,7 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": { + "mrprompt/shipmentcommon": 20, "mockery/mockery": 20 }, "prefer-stable": false, diff --git a/phpunit.xml.dist b/phpunit.xml.dist index f3d0556..650aef7 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -2,8 +2,7 @@ + backupStaticAttributes="false" verbose="true"> @@ -16,17 +15,12 @@ ./tests/Received - - - ./tests/Common - ./vendor ./samples - ./src/Common/Base/Type diff --git a/src/Common/Base/Address.php b/src/Common/Base/Address.php deleted file mode 100644 index 27415af..0000000 --- a/src/Common/Base/Address.php +++ /dev/null @@ -1,215 +0,0 @@ - - */ -class Address -{ - /** - * City - * - * @var string - */ - private $city; - - /** - * State - * - * @var string - */ - private $state; - - /** - * Postal Code - CEP - * - * @var mixed - */ - private $postalCode; - - /** - * - * @var string - */ - private $address; - - /** - * - * @var int - */ - private $number; - - /** - * - * @var string - */ - private $district; - - /** - * - * @var string - */ - private $complement; - - /** - * @return the $city - */ - public function getCity() - { - return $this->city; - } - - /** - * @param string $city - */ - public function setCity($city) - { - try { - Validator::create()->length(null, 200)->assert($city); - - $this->city = $city; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid city name: %s', $city)); - } - } - - /** - * @return the $state - */ - public function getState() - { - return $this->state; - } - - /** - * @param string $state - */ - public function setState($state) - { - try { - Validator::create()->length(null, 2)->assert($state); - - $this->state = $state; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid state value: %s', $state)); - } - } - - /** - * @return the $postalCode - */ - public function getPostalCode() - { - return $this->postalCode; - } - - /** - * @param string $postalCode - */ - public function setPostalCode($postalCode) - { - try { - Validator::notEmpty()->length(8, 8)->assert($postalCode); - - $this->postalCode = $postalCode; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid postal code: "%s"', $postalCode)); - } - } - - /** - * @return the $address - */ - public function getAddress() - { - return $this->address; - } - - /** - * @param string $address - */ - public function setAddress($address) - { - try { - Validator::create()->length(null, 140)->assert($address); - - $this->address = $address; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid address: "%s"', $address)); - } - } - - /** - * @return the $number - */ - public function getNumber() - { - return $this->number; - } - - /** - * @param number $number - */ - public function setNumber($number) - { - try { - $number = trim($number); - - Validator::create()->numeric()->assert($number); - - $this->number = $number; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid address number %s', $number)); - } - - } - - /** - * @return the $district - */ - public function getDistrict() - { - return $this->district; - } - - /** - * @param string $district - */ - public function setDistrict($district) - { - try { - Validator::create()->length(null, 200)->assert($district); - - $this->district = $district; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('District %s is invalid', $district)); - } - } - - /** - * @return the $complement - */ - public function getComplement() - { - return $this->complement; - } - - /** - * @param string $complement - */ - public function setComplement($complement) - { - try { - Validator::create()->length(null, 150)->assert($complement); - - $this->complement = $complement; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Complement %s is invalid', $complement)); - } - } -} diff --git a/src/Common/Base/Authorization.php b/src/Common/Base/Authorization.php deleted file mode 100644 index 9121eea..0000000 --- a/src/Common/Base/Authorization.php +++ /dev/null @@ -1,40 +0,0 @@ - - */ -class Authorization -{ - /** - * @var int - */ - private $number; - - /** - * @return int - */ - public function getNumber() - { - return $this->number; - } - - /** - * @param int $number - */ - public function setNumber($number) - { - try { - Validator::length(0, 20)->assert($number); - - $this->number = $number; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid authorization number: %s', $number)); - } - } -} diff --git a/src/Common/Base/Bank.php b/src/Common/Base/Bank.php deleted file mode 100644 index e0411db..0000000 --- a/src/Common/Base/Bank.php +++ /dev/null @@ -1,118 +0,0 @@ - - */ -class Bank -{ - const BANCO_DO_BRASIL = 30; - const HSBC = 36; - const SANTANDER = 54; - const CAIXA_ECONOMICA_FEDERAL = 55; - const SICRED = 79; - - /** - * @var array - */ - private $codes = [ - self::BANCO_DO_BRASIL, - self::HSBC, - self::SANTANDER, - self::CAIXA_ECONOMICA_FEDERAL, - self::SICRED - ]; - - /** - * - * @var number - */ - private $agency; - - /** - * - * @var number - */ - private $digit; - - /** - * - * @var number - */ - private $code; - - /** - * @return the $agency - */ - public function getAgency() - { - return $this->agency; - } - - /** - * Set the agency - * - * @param number $agency - */ - public function setAgency($agency) - { - try { - Validator::create()->numeric()->assert($agency); - - $this->agency = $agency; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid agency %s', $agency)); - } - } - - /** - * @return the $agencyDigit - */ - public function getDigit() - { - return $this->digit; - } - - /** - * Set the digt - * - * @param number $digit - */ - public function setDigit($digit) - { - try { - Validator::create()->numeric()->assert($digit); - - $this->digit = $digit; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid digit %s', $digit)); - } - } - - /** - * @return number - */ - public function getCode() - { - return $this->code; - } - - /** - * @param number $code - */ - public function setCode($code) - { - try { - Validator::create()->numeric()->in($this->codes)->assert($code); - - $this->code = $code; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid bank code %s', $code)); - } - } -} diff --git a/src/Common/Base/BankAccount.php b/src/Common/Base/BankAccount.php deleted file mode 100644 index 952c77f..0000000 --- a/src/Common/Base/BankAccount.php +++ /dev/null @@ -1,174 +0,0 @@ - - */ -class BankAccount -{ - /** - * @var string - */ - private $account; - - /** - * @var string - */ - private $accountDigit; - - /** - * @var string - */ - private $accountOperation; - - /** - * @var boolean - */ - private $security = false; - - /** - * @var BankInterface - */ - private $bank; - - /** - * @var Person - */ - private $holder; - - /** - * @param Bank $bank - * @param Holder $holder - */ - public function __construct(Bank $bank, Holder $holder) - { - $this->bank = $bank; - $this->holder = $holder; - $this->security = false; - } - - /** - * @return int - */ - public function getNumber() - { - return $this->account; - } - - /** - * @param int $account - */ - public function setNumber($account) - { - try { - Validator::create()->numeric()->assert($account); - - $this->account = $account; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid account number: %s', $account)); - } - } - - /** - * @return int - */ - public function getDigit() - { - return $this->accountDigit; - } - - /** - * @param int $accountDigit - */ - public function setDigit($accountDigit) - { - try { - Validator::create()->numeric()->assert($accountDigit); - - $this->accountDigit = $accountDigit; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid account digit: %s', $accountDigit)); - } - } - - /** - * @return int - */ - public function getOperation() - { - return $this->accountOperation; - } - - /** - * @param string $accountOperation - */ - public function setOperation($accountOperation) - { - try { - Validator::create()->numeric()->assert($accountOperation); - - $this->accountOperation = $accountOperation; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid operation: %s', $accountOperation)); - } - } - - /** - * @return boolean - */ - public function getSecurity() - { - return $this->security; - } - - /** - * @param boolean $security - */ - public function setSecurity($security = false) - { - try { - Validator::boolType()->assert($security); - - $this->security = $security; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Security life must be true or false', $security)); - } - } - - /** - * @return Bank - */ - public function getBank() - { - return $this->bank; - } - - /** - * @param Bank $bank - */ - public function setBank(Bank $bank) - { - $this->bank = $bank; - } - - /** - * @return Person - */ - public function getHolder() - { - return $this->holder; - } - - /** - * @param Holder $holder - */ - public function setHolder(Holder $holder) - { - $this->holder = $holder; - } -} diff --git a/src/Common/Base/Billet.php b/src/Common/Base/Billet.php deleted file mode 100644 index 36f17b1..0000000 --- a/src/Common/Base/Billet.php +++ /dev/null @@ -1,134 +0,0 @@ - - */ -class Billet -{ - /** - * @var ArrayObject - */ - private $details; - - /** - * @var float - */ - private $rate; - - /** - * @var BankAccount - */ - private $bankAccount; - - /** - * @var Seller - */ - private $assignor; - - /** - * @var string - */ - private $number; - - /** - * Constructor - */ - public function __construct() - { - $this->details = new ArrayObject(); - } - - /** - * @return ArrayObject - */ - public function getDetails() - { - return $this->details; - } - - /** - * @param ArrayObject $details - */ - public function setDetails(ArrayObject $details) - { - $this->details = $details; - } - - /** - * @param Detail $detail - */ - public function addDetail(Detail $detail) - { - $this->details->append($detail); - } - - /** - * @return float - */ - public function getRate() - { - return $this->rate; - } - - /** - * @param float $rate - */ - public function setRate($rate) - { - $this->rate = $rate; - } - - /** - * @return BankAccount - */ - public function getBankAccount() - { - return $this->bankAccount; - } - - /** - * @param BankAccount $bankAccount - */ - public function setBankAccount(BankAccount $bankAccount) - { - $this->bankAccount = $bankAccount; - } - - /** - * @return Seller - */ - public function getAssignor() - { - return $this->assignor; - } - - /** - * @param Seller $assignor - */ - public function setAssignor(Seller $assignor) - { - $this->assignor = $assignor; - } - - /** - * @return string - */ - public function getNumber() - { - return $this->number; - } - - /** - * @param string $number - */ - public function setNumber($number) - { - $this->number = $number; - } -} diff --git a/src/Common/Base/Cart.php b/src/Common/Base/Cart.php deleted file mode 100644 index 85af519..0000000 --- a/src/Common/Base/Cart.php +++ /dev/null @@ -1,32 +0,0 @@ - - */ -class Cart extends ArrayObject -{ - /** - * @param mixed $item - */ - public function addItem($item) - { - $this->append($item); - } - - /** - * @param mixed $item - */ - public function removeItem($item) - { - if (!$this->offsetExists($item)) { - throw new \InvalidArgumentException(sprintf('Item "%s" not exists', $item)); - } - - $this->offsetUnset($item); - } -} \ No newline at end of file diff --git a/src/Common/Base/Charge.php b/src/Common/Base/Charge.php deleted file mode 100644 index 4fc21e7..0000000 --- a/src/Common/Base/Charge.php +++ /dev/null @@ -1,124 +0,0 @@ - - */ -class Charge -{ - /** - * Billet - * - * @const string - */ - const BILLET = 'B'; - - /** - * Credit card - * - * @const string - */ - const CREDIT_CARD = 'C'; - - /** - * Debit on bank account - * - * @const string - */ - const DEBIT = 'D'; - - /** - * Energy account - * - * @const string - */ - const ENERGY = 'E'; - - /** - * Batch File - * - * @const string - */ - const BATCH_FILE = 'F'; - - /** - * Payment Slip - * - * @const string - */ - const PAYMENT_SLIP = 'P'; - - /** - * Charging type - * - * Types: - * - B = Boleto Bancário - * - E = Energia - * - C = Cartão de Crédito - * - D = Débito Automático - * - D = Arquivo de Remessa - * - P = Bloqueto - * - * @var string - */ - private $charging = self::CREDIT_CARD; - - /** - * Occurrence - * - * @var string - */ - private $occurrence = Occurrence::INSERT; - - /** - * @return the $charging - */ - public function getCharging() - { - return $this->charging; - } - - /** - * @param string $charging - */ - public function setCharging($charging) - { - try { - $validTypes = [ - self::BILLET, - self::CREDIT_CARD, - self::DEBIT, - self::ENERGY, - self::BATCH_FILE, - self::PAYMENT_SLIP - ]; - - Validator::create()->notEmpty()->alpha()->in($validTypes)->assert($charging); - - $this->charging = $charging; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid charge type: %s', $charging)); - } - } - - /** - * @return Occurrence - */ - public function getOccurrence() - { - return $this->occurrence; - } - - /** - * @param Occurrence $occurrence - */ - public function setOccurrence(Occurrence $occurrence) - { - $this->occurrence = $occurrence; - } -} diff --git a/src/Common/Base/Client.php b/src/Common/Base/Client.php deleted file mode 100644 index 2922473..0000000 --- a/src/Common/Base/Client.php +++ /dev/null @@ -1,51 +0,0 @@ - - */ -class Client -{ - /** - * @var int - */ - private $code; - - /** - * @param int $code - */ - public function __construct($code = null) - { - $this->code = $code; - } - - /** - * @return int - */ - public function getCode() - { - return $this->code; - } - - /** - * @param int $code - * @return void - * @throws InvalidArgumentException - */ - public function setCode($code) - { - try { - Validator::numeric()->assert($code); - - $this->code = $code; - } catch (AllOfException $ex) { - throw new InvalidArgumentException(sprintf('Code must be a numeric value, %s is invalid', $code)); - } - } -} diff --git a/src/Common/Base/ConsumerUnity.php b/src/Common/Base/ConsumerUnity.php deleted file mode 100644 index 7615425..0000000 --- a/src/Common/Base/ConsumerUnity.php +++ /dev/null @@ -1,147 +0,0 @@ - - */ -class ConsumerUnity -{ - const BANDEIRANTE = 1; - const CPFL = 3; - const CPFL_PIRATININGA = 4; - const AMPLA = 5; - const ESCELSA_ES = 19; - const CELESC = 26; - const RGE_RS = 31; - const COELCE = 73; - - /** - * @var array - */ - private $codes = [ - self::BANDEIRANTE, - self::CPFL, - self::CPFL_PIRATININGA, - self::AMPLA, - self::ESCELSA_ES, - self::CELESC, - self::RGE_RS, - self::COELCE, - ]; - - /** - * @var int - */ - private $number; - - /** - * @var int - */ - private $code; - - /** - * @var DateTime - */ - private $read; - - /** - * @var DateTime - */ - private $maturity; - - /** - * Constructor - */ - public function __construct() - { - $this->read = new DateTime(); - $this->maturity = new DateTime(); - } - - /** - * Get the number - * - * @return int - */ - public function getNumber() - { - return $this->number; - } - - /** - * Set the consumer number - * - * @param int $number - * @return void - */ - public function setNumber($number) - { - try { - Validator::create()->notEmpty()->assert($number); - - $this->number = $number; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Number of consumer unity %s is invalid', $number)); - } - } - - /** - * @return mixed - */ - public function getRead() - { - return $this->read; - } - - /** - * @param DateTime $read - */ - public function setRead(DateTime $read) - { - $this->read = $read; - } - - /** - * @return DateTime - */ - public function getMaturity() - { - return $this->maturity; - } - - /** - * @param DateTime $maturity - */ - public function setMaturity(DateTime $maturity) - { - $this->maturity = $maturity; - } - - /** - * @return number - */ - public function getCode() - { - return $this->code; - } - - /** - * @param number $code - */ - public function setCode($code) - { - try { - Validator::create()->notEmpty()->numeric()->in($this->codes)->assert($code); - - $this->code = $code; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid consumer unity value %s', $code)); - } - } -} diff --git a/src/Common/Base/CreditCard.php b/src/Common/Base/CreditCard.php deleted file mode 100644 index 122818b..0000000 --- a/src/Common/Base/CreditCard.php +++ /dev/null @@ -1,168 +0,0 @@ - - */ -class CreditCard -{ - const AMEX = 38; - const MASTERCARD = 39; - const HIPERCARD = 40; - const DINNERS = 41; - const DISCOVER = 45; - const VISA = 42; - const AURA = 51; - const ELO = 60; - const GOODCARD = 61; - const JCB = 62; - const MAIS = 63; - const CABAL = 64; - const SOROCRED = 65; - const SICREDI = 66; - const COOPERCRED = 67; - const AVISTA = 68; - - /** - * Valid flags - * - * @var array - */ - private $flags = [ - self::AMEX, - self::MASTERCARD, - self::HIPERCARD, - self::DINNERS, - self::DISCOVER, - self::VISA, - self::AURA, - self::ELO, - self::GOODCARD, - self::JCB, - self::MAIS, - self::CABAL, - self::SOROCRED, - self::SICREDI, - self::COOPERCRED, - self::AVISTA - ]; - - /** - * - * @var numeric - */ - private $number; - - /** - * - * @var DateTime - */ - private $validate; - - /** - * - * @var numeric - */ - private $security; - - /** - * @var numeric - */ - private $flag; - - /** - * Constructor - */ - public function __construct() - { - $this->validate = new DateTime(); - } - - /** - * @return the $number - */ - public function getNumber() - { - return $this->number; - } - - /** - * @param string $number - */ - public function setNumber($number) - { - try { - Validator::create()->notEmpty()->creditCard()->assert($number); - - $this->number = $number; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid credit card number: %s', $number)); - } - } - - /** - * @return the $validate - */ - public function getValidate() - { - return $this->validate; - } - - /** - * @param DateTime $validate - */ - public function setValidate(DateTime $validate) - { - $this->validate = $validate; - } - - /** - * @return the $security - */ - public function getSecurityNumber() - { - return $this->security; - } - - /** - * @param string $security - */ - public function setSecurityNumber($security) - { - try { - Validator::create()->notEmpty()->numeric()->assert($security); - - $this->security = $security; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid security number: %s', $security)); - } - } - - /** - * @return string - */ - public function getFlag() - { - return $this->flag; - } - - /** - * @param string $flag - */ - public function setFlag($flag) - { - try { - Validator::create()->notEmpty()->numeric()->in($this->flags)->assert($flag); - - $this->flag = $flag; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid flag: %s', $flag)); - } - } -} diff --git a/src/Common/Base/Customer.php b/src/Common/Base/Customer.php deleted file mode 100644 index 8ddf635..0000000 --- a/src/Common/Base/Customer.php +++ /dev/null @@ -1,136 +0,0 @@ - - */ -class Customer extends Person -{ - /** - * @var int - */ - private $code; - - /** - * @var int - */ - private $identityNumber; - - /** - * @var bool - */ - private $helpfulMaturity; - - /** - * @var int - */ - private $workingDays; - - /** - * @return int - */ - public function getCode() - { - return $this->code; - } - - /** - * @param int $code - * @return void - */ - public function setCode($code) - { - try { - Validator - ::create() - ->notEmpty() - ->assert($code); - - $this->code = $code; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid customer code: %s', $code)); - } - } - - /** - * @return int - */ - public function getIdentityNumber() - { - return $this->identityNumber; - } - - /** - * @param int $identityNumber - */ - public function setIdentityNumber($identityNumber) - { - try { - $number = floor($identityNumber); - - Validator - ::create() - ->numeric() - ->assert($number); - - $this->identityNumber = $number; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid identity number: %s', $identityNumber)); - } - } - - /** - * @return mixed - */ - public function getHelpfulMaturity() - { - return $this->helpfulMaturity; - } - - /** - * @param boolean $helpfulMaturity - */ - public function setHelpfulMaturity($helpfulMaturity = true) - { - try { - Validator - ::create() - ->boolType() - ->assert($helpfulMaturity); - - $this->helpfulMaturity = $helpfulMaturity; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid helpful maturity state: %s', $helpfulMaturity)); - } - } - - /** - * @return int - */ - public function getWorkingDays() - { - return $this->workingDays; - } - - /** - * @param int $workingDays - */ - public function setWorkingDays($workingDays) - { - try { - Validator - ::create() - ->notEmpty() - ->intType() - ->assert($workingDays); - - $this->workingDays = $workingDays; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid working days: %s', $workingDays)); - } - } -} diff --git a/src/Common/Base/Dealership.php b/src/Common/Base/Dealership.php deleted file mode 100644 index 85f9086..0000000 --- a/src/Common/Base/Dealership.php +++ /dev/null @@ -1,71 +0,0 @@ - - */ -class Dealership -{ - /** - * @var int - */ - private $code; - - /** - * @var string - */ - private $name; - - /** - * Return the dealeship code - * - * @return int - */ - public function getCode() - { - return $this->code; - } - - /** - * Dealership code - * - * @param int $code - */ - public function setCode($code) - { - try { - Validator::stringType()->length(null, 6)->assert($code); - - $this->code = $code; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid dealership code: %s', $code)); - } - } - - /** - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * @param string $name - */ - public function setName($name) - { - try { - Validator::create()->notEmpty()->assert($name); - - $this->name = $name; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid dealership name: %s', $name)); - } - } -} diff --git a/src/Common/Base/Document.php b/src/Common/Base/Document.php deleted file mode 100644 index 6326739..0000000 --- a/src/Common/Base/Document.php +++ /dev/null @@ -1,95 +0,0 @@ - - */ -class Document -{ - /** - * CPF - for individual - * - * @const int - */ - const CPF = 1; - - /** - * CNPJ - for Legal Entity - * - */ - const CNPJ = 2; - - /** - * @var string - */ - private $type = self::CPF; - - /** - * @var int - */ - private $number; - - /** - * @param int $type - */ - public function __construct($type = self::CPF) - { - $this->setType($type); - } - - /** - * @return string - */ - public function getType() - { - return $this->type; - } - - /** - * @param string $type - */ - public function setType($type) - { - try { - Validator - ::numeric() - ->notEmpty() - ->in([self::CPF, self::CNPJ]) - ->assert($type); - - $this->type = $type; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid document type: %s', $type)); - } - } - - /** - * @return mixed - */ - public function getNumber() - { - return $this->number; - } - - /** - * @param mixed $number - */ - public function setNumber($number) - { - try { - Validator - ::stringType() - ->length(11, 18) - ->assert($number); - - $this->number = $number; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Document #%s is invalid', $number)); - } - } -} diff --git a/src/Common/Base/Email.php b/src/Common/Base/Email.php deleted file mode 100644 index 475dd29..0000000 --- a/src/Common/Base/Email.php +++ /dev/null @@ -1,90 +0,0 @@ - - */ -class Email -{ - /** - * @var string - */ - private $address; - - /** - * @var boolean - */ - private $primary; - - /** - * @param string $address - * @param bool $primary - */ - public function __construct($address, $primary = true) - { - $this->setAddress($address); - $this->setPrimary($primary); - } - - /** - * @return string - */ - public function getAddress() - { - return $this->address; - } - - /** - * @param string $address - */ - public function setAddress($address) - { - try { - Validator::notEmpty()->email()->assert($address); - - $this->address = $address; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException( - sprintf('E-mails address "%s" is invalid', $address) - ); - } - } - - /** - * @return boolean - */ - public function isPrimary() - { - return $this->primary; - } - - /** - * @return boolean - */ - public function getPrimary() - { - return $this->primary; - } - - /** - * @param boolean $primary - */ - public function setPrimary($primary) - { - try { - - Validator::notEmpty()->boolType()->assert($primary); - - $this->primary = $primary; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException( - sprintf('The primary only accept boolean value, %s is invalid', $primary) - ); - } - } -} \ No newline at end of file diff --git a/src/Common/Base/Holder.php b/src/Common/Base/Holder.php deleted file mode 100644 index 0f99afc..0000000 --- a/src/Common/Base/Holder.php +++ /dev/null @@ -1,45 +0,0 @@ - - */ -class Holder extends Person -{ - /** - * @var int - */ - private $code; - - /** - * @return int - */ - public function getCode() - { - return $this->code; - } - - /** - * @param int $code - * @return void - */ - public function setCode($code) - { - try { - Validator - ::create() - ->notEmpty() - ->intType() - ->assert($code); - - $this->code = $code; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Holder code %s is invalid', $code)); - } - } -} diff --git a/src/Common/Base/Occurrence.php b/src/Common/Base/Occurrence.php deleted file mode 100644 index e258e4e..0000000 --- a/src/Common/Base/Occurrence.php +++ /dev/null @@ -1,143 +0,0 @@ - - */ -class Occurrence -{ - /** - * Insert ocurrence - * - * @const string - */ - const INSERT = 'I'; - - /** - * Cancel occurrence - * - * @const string - */ - const CANCEL = 'C'; - - /** - * Update occurrence - * - * @const string - */ - const UPDATE = 'A'; - - /** - * Occurrence type - * - * @var string - */ - private $type = self::INSERT; - - /** - * Occurrence Return Code - * - * @var int - */ - private $return; - - /** - * Occurrence Description - * - * @var string - */ - private $description; - - /** - * @var DateTime - */ - private $date; - - /** - * @return string - */ - public function getType() - { - return $this->type; - } - - /** - * @param string $type - */ - public function setType($type) - { - try { - Validator::in([self::INSERT, self::CANCEL, self::UPDATE])->assert($type); - - $this->type = $type; - } catch (AllOfException $e) { - throw new \InvalidArgumentException(sprintf('Invalid occurrence type: %S', $type)); - } - } - - /** - * @return int - */ - public function getReturn() - { - return $this->return; - } - - /** - * @param int $return - */ - public function setReturn($return = 0) - { - try { - Validator::numeric()->assert($return); - - $this->return = $return; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid occurrence return value: %s', $return)); - } - } - - /** - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * @param string $description - */ - public function setDescription($description = '') - { - try { - Validator::stringType()->assert($description); - - $this->description = $description; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid description: %s', $description)); - } - } - - /** - * @return DateTime - */ - public function getDate() - { - return $this->date; - } - - /** - * @param DateTime $date - */ - public function setDate(DateTime $date) - { - $this->date = $date; - } -} diff --git a/src/Common/Base/Parcel.php b/src/Common/Base/Parcel.php deleted file mode 100644 index 5607c31..0000000 --- a/src/Common/Base/Parcel.php +++ /dev/null @@ -1,139 +0,0 @@ - - */ -class Parcel -{ - /** - * - * @var DateTime - */ - private $maturity; - - /** - * - * @var float - */ - private $price; - - /** - * @var int - */ - private $key; - - /** - * @var int - */ - private $quantity; - - /** - * @var int - */ - private $status; - - /** - * @return the $maturity - */ - public function getMaturity() - { - return $this->maturity; - } - - /** - * @param \DateTime $maturity - */ - public function setMaturity(DateTime $maturity) - { - $this->maturity = $maturity; - } - - /** - * @return the $price - */ - public function getPrice() - { - return $this->price; - } - - /** - * @param float $price - */ - public function setPrice($price) - { - try { - Validator::create()->numeric()->assert($price); - - $this->price = $price; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid parcel price: %s', $price)); - } - } - - /** - * @return int - */ - public function getKey() - { - return $this->key; - } - - /** - * @param int $key - */ - public function setKey($key = 0) - { - try { - Validator::numeric()->assert($key); - - $this->key = (int) $key; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid parcel key: %s', $key)); - } - } - - /** - * @return int - */ - public function getQuantity() - { - return $this->quantity; - } - - /** - * @param int $quantity - */ - public function setQuantity($quantity) - { - try { - Validator::create()->notEmpty()->numeric()->assert($quantity); - - $this->quantity = $quantity; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid parcel quantity: %s', $quantity)); - } - } - - /** - * @return int - */ - public function getStatus() - { - return $this->status; - } - - /** - * @param int $status - */ - public function setStatus($status) - { - $this->status = $status; - } -} diff --git a/src/Common/Base/Parcels.php b/src/Common/Base/Parcels.php deleted file mode 100644 index ec72752..0000000 --- a/src/Common/Base/Parcels.php +++ /dev/null @@ -1,31 +0,0 @@ - - */ -class Parcels extends SplFixedArray -{ - /** - * Constructor - * - * @param int $quantity - */ - public function __construct($quantity = 1) - { - parent::__construct($quantity); - } - - /** - * @param Parcel $parcel - */ - public function addParcel(Parcel $parcel) - { - $this->offsetSet($this->key(), $parcel); - $this->next(); - } -} diff --git a/src/Common/Base/Person.php b/src/Common/Base/Person.php deleted file mode 100644 index d58058e..0000000 --- a/src/Common/Base/Person.php +++ /dev/null @@ -1,299 +0,0 @@ - - */ -class Person -{ - /** - * @var string - */ - private $name; - - /** - * @var Document - */ - private $document; - - /** - * @var string - */ - private $email; - - /** - * @var Phone - */ - private $cellPhone; - - /** - * @var Phone - */ - private $homePhone; - - /** - * @var Phone - */ - private $homePhoneSecondary; - - /** - * - * @var string - */ - private $fatherName; - - /** - * - * @var string - */ - private $motherName; - - /** - * Person type - * - * F = Física - * J = Jurídica - * - * @var string - */ - private $person = 'F'; - - /** - * Salaried situation - * - * A = active - * I = inactive - */ - private $salaried = 'A'; - - /** - * Birth - * - * @var DateTime - */ - private $birth; - - /** - * Address - * - * @var Address - */ - private $address; - - /** - * Constructor - * - */ - public function __construct() - { - $this->person = 'F'; - $this->salaried = 'A'; - $this->birth = new DateTime(); - $this->document = new Document(); - $this->address = new Address(); - } - - /** - * @return Document - */ - public function getDocument() - { - return $this->document; - } - - /** - * @param Document $document - */ - public function setDocument(Document $document) - { - $this->document = $document; - } - - /** - * @return Phone - */ - public function getHomePhone() - { - return $this->homePhone; - } - - /** - * @param Phone $homePhone - */ - public function setHomePhone(Phone $homePhone) - { - $this->homePhone = $homePhone; - } - - /** - * @return Phone - */ - public function getHomePhoneSecondary() - { - return $this->homePhoneSecondary; - } - - /** - * @param Phone $homePhone - */ - public function setHomePhoneSecondary(Phone $homePhone) - { - $this->homePhoneSecondary = $homePhone; - } - - /** - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * @param string $name - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * @return Email - */ - public function getEmail() - { - return $this->email; - } - - /** - * @param Email $email - */ - public function setEmail(Email $email) - { - $this->email = $email; - } - - /** - * @return Phone - */ - public function getCellPhone() - { - return $this->cellPhone; - } - - /** - * @param Phone $cellPhone - */ - public function setCellPhone($cellPhone) - { - $this->cellPhone = $cellPhone; - } - - /** - * @return the $fatherName - */ - public function getFatherName() - { - return $this->fatherName; - } - - /** - * @param string $fatherName - */ - public function setFatherName($fatherName) - { - $this->fatherName = $fatherName; - } - - /** - * @return the $motherName - */ - public function getMotherName() - { - return $this->motherName; - } - - /** - * @param string $motherName - */ - public function setMotherName($motherName) - { - $this->motherName = $motherName; - } - - /** - * @return the $person - */ - public function getPerson() - { - return $this->person; - } - - /** - * @param string $person - * @throws \InvalidArgumentException - */ - public function setPerson($person) - { - try { - Validator::create()->stringType()->in(['F', 'J'])->assert($person); - - $this->person = $person; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid person type: "%s"', $person), 500, $ex); - } - } - - /** - * @return mixed - */ - public function getSalaried() - { - return $this->salaried; - } - - /** - * @param mixed $salaried - */ - public function setSalaried($salaried) - { - $this->salaried = $salaried; - } - - /** - * @return DateTime - */ - public function getBirth() - { - return $this->birth; - } - - /** - * @param DateTime $birth - */ - public function setBirth(DateTime $birth) - { - $this->birth = $birth; - } - - /** - * @return Address - */ - public function getAddress() - { - return $this->address; - } - - /** - * @param Address $address - */ - public function setAddress(Address $address) - { - $this->address = $address; - } -} diff --git a/src/Common/Base/Phone.php b/src/Common/Base/Phone.php deleted file mode 100644 index f9a13fb..0000000 --- a/src/Common/Base/Phone.php +++ /dev/null @@ -1,87 +0,0 @@ - - */ -class Phone -{ - /** - * @const int - */ - const CELLPHONE = 1; - - /** - * @const int - */ - const TELEPHONE = 2; - - /** - * @var int - */ - private $number; - - /** - * @var int - */ - private $type; - - /** - * Constructor - * - * @param int $type - */ - public function __construct($type = self::TELEPHONE) - { - $this->setType($type); - } - - /** - * @return int - */ - public function getNumber() - { - return $this->number; - } - - /** - * @param int $number - */ - public function setNumber($number) - { - try { - Validator::stringType()->notEmpty()->length(8, 20)->assert($number); - - $this->number = $number; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid phone number: %s', $number)); - } - } - - /** - * @return int - */ - public function getType() - { - return $this->type; - } - - /** - * @param int $type - */ - public function setType($type) - { - try { - Validator::intType()->in([self::CELLPHONE, self::TELEPHONE])->assert($type); - - $this->type = $type; - } catch (AllOfException $ex) { - throw new \InvalidArgumentException(sprintf('Invalid phone type: %s', $type)); - } - } -} diff --git a/src/Common/Base/Purchaser.php b/src/Common/Base/Purchaser.php deleted file mode 100644 index 1e851b0..0000000 --- a/src/Common/Base/Purchaser.php +++ /dev/null @@ -1,79 +0,0 @@ - - */ -class Purchaser extends Person -{ - /** - * Fantasy name - * - * @var string - */ - private $purchaserFantasyName; - - /** - * Social Reason - * - * @var string - */ - private $purchaserSocialReason; - - /** - * State Registration - * - * @var string - */ - private $purchaserStateRegistration; - - /** - * @return string - */ - public function getPurchaserStateRegistration() - { - return $this->purchaserStateRegistration; - } - - /** - * @param string $purchaserStateRegistration - */ - public function setPurchaserStateRegistration($purchaserStateRegistration) - { - $this->purchaserStateRegistration = $purchaserStateRegistration; - } - - /** - * @return the $purchaserFantasyName - */ - public function getPurchaserFantasyName() - { - return $this->purchaserFantasyName; - } - - /** - * @param mixed $purchaserFantasyName - */ - public function setPurchaserFantasyName($purchaserFantasyName) - { - $this->purchaserFantasyName = $purchaserFantasyName; - } - - /** - * @return the $purchaserSocialReason - */ - public function getPurchaserSocialReason() - { - return $this->purchaserSocialReason; - } - - /** - * @param mixed $purchaserSocialReason - */ - public function setPurchaserSocialReason($purchaserSocialReason) - { - $this->purchaserSocialReason = $purchaserSocialReason; - } -} diff --git a/src/Common/Base/Seller.php b/src/Common/Base/Seller.php deleted file mode 100644 index de7c48f..0000000 --- a/src/Common/Base/Seller.php +++ /dev/null @@ -1,43 +0,0 @@ - - */ -class Seller extends Person -{ - /** - * @var int - */ - private $code; - - /** - * @return int - */ - public function getCode() - { - return $this->code; - } - - /** - * @param int $code - * @return void - * @throws InvalidArgumentException - */ - public function setCode($code) - { - try { - Validator::notEmpty()->assert($code); - - $this->code = $code; - } catch (AllOfException $ex) { - throw new InvalidArgumentException(sprintf('Invalid seller code %s', $code)); - } - } -} diff --git a/src/Common/Base/Sequence.php b/src/Common/Base/Sequence.php deleted file mode 100644 index 5307921..0000000 --- a/src/Common/Base/Sequence.php +++ /dev/null @@ -1,59 +0,0 @@ - - */ -class Sequence -{ - /** - * @var int - */ - private $value; - - /** - * Construtor - * - * @param int $value - */ - public function __construct($value = 1) - { - $this->setValue($value); - } - - /** - * Return the value from sequence - * - * @return int - */ - public function getValue() - { - return $this->value; - } - - /** - * Set the value from sequence - * - * @param int $value - * @return void - * @throws InvalidArgumentException - */ - public function setValue($value) - { - try { - $value = (int) $value; - - Validator::notEmpty()->numeric()->assert($value); - - $this->value = $value; - } catch (AllOfException $ex) { - throw new InvalidArgumentException(sprintf('Sequence value must be a numeric value, %s is invalid', $value)); - } - } -} diff --git a/src/Common/Type/Alphanumeric.php b/src/Common/Type/Alphanumeric.php deleted file mode 100644 index d5270ae..0000000 --- a/src/Common/Type/Alphanumeric.php +++ /dev/null @@ -1,13 +0,0 @@ - - */ -abstract class Alphanumeric -{ - const ALIGN = STR_PAD_RIGHT; - const FILL = ' '; -} \ No newline at end of file diff --git a/src/Common/Type/Number.php b/src/Common/Type/Number.php deleted file mode 100644 index 7043a85..0000000 --- a/src/Common/Type/Number.php +++ /dev/null @@ -1,13 +0,0 @@ - - */ -abstract class Number -{ - const ALIGN = STR_PAD_LEFT; - const FILL = 0; -} \ No newline at end of file diff --git a/src/Common/Util/Number.php b/src/Common/Util/Number.php deleted file mode 100755 index f2dab97..0000000 --- a/src/Common/Util/Number.php +++ /dev/null @@ -1,38 +0,0 @@ - - */ -abstract class Number -{ - const FILL_LEFT = 0; - const FILL_RIGHT = 1; - - /** - * @param $value - * @param $length - * @param int $fillSide - * @return string - * @throws \InvalidArgumentException - */ - public static function zeroFill($value = '', $length = 0, $fillSide = self::FILL_LEFT) - { - $valueLength = strlen($value); - - if ($valueLength == $length) { - return $value; - } - - if ($valueLength > $length) { - throw new \InvalidArgumentException(sprintf( - 'The given value (%s) is invalid', - $value - )); - } - - return str_pad($value, $length, 0, $fillSide); - } -} diff --git a/src/Factory.php b/src/Factory.php index b9c9149..4142977 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -1,26 +1,26 @@ setType(strlen($campos['documento']) === 11 ? Document::CPF : Document::CNPJ); - $document->setNumber($campos['documento']); + $document->setNumber((int) $campos['documento']); return $document; } @@ -51,8 +51,8 @@ public static function createDocumentFromArray(array $campos = []) public static function createCustomerFromArray(array $campos = []) { $customer = new Customer(); - $customer->setCode($campos['cliente']); - $customer->setIdentityNumber($campos['identificador']); + $customer->setCode((int) $campos['cliente']); + $customer->setIdentityNumber((int) $campos['identificador']); return $customer; } @@ -340,7 +340,7 @@ public static function createBilletFromArray(array $campos = []) if (array_key_exists('boleto', $campos)) { $billet->setBankAccount(self::createBankAccountFromArray($campos['boleto'])); - $billet->setNumber($campos['boleto']['documento']); + $billet->setNumber((int) $campos['boleto']['documento']); } return $billet; diff --git a/src/Received/File.php b/src/Received/File.php index 9b28c73..1376a75 100644 --- a/src/Received/File.php +++ b/src/Received/File.php @@ -1,13 +1,13 @@ */ -class Detail +class Detail extends \stdClass { /** * Customer diff --git a/src/Received/Partial/Footer.php b/src/Received/Partial/Footer.php index 027bd9d..4d421ae 100644 --- a/src/Received/Partial/Footer.php +++ b/src/Received/Partial/Footer.php @@ -1,7 +1,7 @@ $this->sequence->getValue(), ]); - /* @var $parcels \MrPrompt\CaixaEconomicaFederal\Common\Base\Parcels */ + /* @var $parcels \MrPrompt\ShipmentCommon\Base\Parcels */ $parcels = $item->getParcels(); - /* @var $parcel \MrPrompt\CaixaEconomicaFederal\Common\Base\Parcel */ + /* @var $parcel \MrPrompt\ShipmentCommon\Base\Parcel */ foreach ($parcels as $parcel) { /* @var $purchaser Purchaser */ $purchaser = $item->getPurchaser(); diff --git a/src/Shipment/Partial/Detail.php b/src/Shipment/Partial/Detail.php index c03419c..c94b604 100644 --- a/src/Shipment/Partial/Detail.php +++ b/src/Shipment/Partial/Detail.php @@ -1,21 +1,21 @@ */ -class Detail +class Detail extends \stdClass { /** * Customer diff --git a/src/Shipment/Partial/Footer.php b/src/Shipment/Partial/Footer.php index 2a7abac..8788885 100644 --- a/src/Shipment/Partial/Footer.php +++ b/src/Shipment/Partial/Footer.php @@ -1,7 +1,7 @@ - */ -class AddressTest extends TestCase -{ - use ChangeProtectedAttribute; - - /** - * @var Address - */ - private $address; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() - { - parent::setUp(); - - $this->address = new Address(); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() - { - $this->address = null; - - parent::tearDown(); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Address::getCity() - */ - public function getCityReturnCityAttribute() - { - $this->modifyAttribute($this->address, 'city', 'foo'); - - $this->assertEquals('foo', $this->address->getCity()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Address::setCity() - */ - public function setCityReturnNull() - { - $result = $this->address->setCity('foo'); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Address::setCity() - */ - public function setCityReturnNullWhenEmpty() - { - $result = $this->address->setCity(''); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Address::setCity() - * @expectedException \InvalidArgumentException - */ - public function setCityThrowsExceptionWhenExceedMaxLength() - { - $city = str_pad('x', 201, 'x'); - $result = $this->address->setCity($city); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Address::getState() - */ - public function getStateReturnStateAttribute() - { - $state = 'SC'; - - $this->modifyAttribute($this->address, 'state', $state); - - $this->assertEquals($state, $this->address->getState()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Address::setState() - */ - public function setStateReturnNull() - { - $this->assertNull($this->address->setState('SC')); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Address::setState() - */ - public function setStateReturnNullWhenEmpty() - { - $this->assertNull($this->address->setState('')); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Address::setState() - * @expectedException \InvalidArgumentException - */ - public function setStateThrowsExceptionWhenDiferentOfTwoChars() - { - $this->assertNull($this->address->setState('SCS')); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Address::getPostalCode() - */ - public function getPostalCodeReturnPostalCodeAttribute() - { - $postalCode = '88090080'; - - $this->modifyAttribute($this->address, 'postalCode', $postalCode); - - $this->assertEquals($postalCode, $this->address->getPostalCode()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Address::setPostalCode() - */ - public function setPostalCodeReturnNull() - { - $result = $this->address->setPostalCode('88080090'); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Address::setPostalCode() - * @expectedException \InvalidArgumentException - */ - public function setPostalCodeThrowsExceptionWhenExceedMaxLength() - { - $result = $this->address->setPostalCode('8808009012'); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Address::setPostalCode() - * @expectedException \InvalidArgumentException - */ - public function setPostalCodeThrowsExceptionWhenEmpty() - { - $result = $this->address->setPostalCode(''); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Address::setPostalCode() - * @expectedException \InvalidArgumentException - */ - public function setPostalCodeThrowsExceptionWhenMinorOfMinLength() - { - $result = $this->address->setPostalCode('88090'); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Address::getAddress() - */ - public function getAddressReturnAddressAttribute() - { - $address = 'fooo'; - - $this->modifyAttribute($this->address, 'address', $address); - - $this->assertEquals($address, $this->address->getAddress()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Address::setAddress() - */ - public function setAddressReturnNull() - { - $this->assertNull($this->address->setAddress('foo')); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Address::setAddress() - */ - public function setAddressReturnNullWhemEmpty() - { - $this->assertNull($this->address->setAddress(' ')); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Address::setAddress() - * @expectedException \InvalidArgumentException - */ - public function setAddressThrowsExceptionWhenExceedMaxLength() - { - $this->assertNull($this->address->setAddress(str_pad('x', 160, 'x'))); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Address::getNumber() - */ - public function getNumberReturnNumberAttribute() - { - $number = 5; - - $this->modifyAttribute($this->address, 'number', $number); - - $this->assertEquals($number, $this->address->getNumber()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Address::setNumber() - */ - public function setNumberReturnNull() - { - $this->assertNull($this->address->setNumber(1)); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Address::setNumber() - * @expectedException \InvalidArgumentException - */ - public function setNumberThrowsExceptionWhenNotNumber() - { - $this->assertNull($this->address->setNumber('A2')); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Address::getDistrict() - */ - public function getDistrictReturnDistrictAttribute() - { - $district = 'allaa'; - - $this->modifyAttribute($this->address, 'district', $district); - - $this->assertEquals($district, $this->address->getDistrict()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Address::setDistrict() - */ - public function setDistrictReturnNull() - { - $this->assertNull($this->address->setDistrict('lalala')); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Address::setDistrict() - * @expectedException \InvalidArgumentException - */ - public function setDistrictThrowsExceptionWhenExceedMaximumValue() - { - $this->assertNull($this->address->setDistrict(str_pad('x', 201, 'x'))); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Address::getComplement() - */ - public function getComplementReturnComplementAttribute() - { - $complement = 'lalala'; - - $this->modifyAttribute($this->address, 'complement', $complement); - - $this->assertEquals($complement, $this->address->getComplement()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Address::setComplement() - */ - public function setComplementReturnNull() - { - $this->assertNull($this->address->setComplement('lalajd')); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Address::setComplement() - * @expectedException \InvalidArgumentException - */ - public function setComplementThrowsExceptionWhenExceedMaximumValue() - { - $this->assertNull($this->address->setComplement(str_pad('x', 201, 'x'))); - } -} diff --git a/tests/Common/Base/AuthorizationTest.php b/tests/Common/Base/AuthorizationTest.php deleted file mode 100644 index b18dd8a..0000000 --- a/tests/Common/Base/AuthorizationTest.php +++ /dev/null @@ -1,66 +0,0 @@ - - */ -class AuthorizationTest extends TestCase -{ - use ChangeProtectedAttribute; - - /** - * @var Authorization - */ - private $authorization; - - /** - * Prepares the environment before running a test. - */ - public function setUp() - { - parent::setUp(); - - $this->authorization = new Authorization(); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Authorization::getNumber - */ - public function getNumberMustBeReturnNumberAttribute() - { - $this->modifyAttribute($this->authorization, 'number', 1); - - $this->assertEquals(1, $this->authorization->getNumber()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Authorization::setNumber - */ - public function setNumberMustBeReturnNull() - { - $result = $this->authorization->setNumber('lajskfsla'); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Authorization::setNumber - * @expectedException \InvalidArgumentException - */ - public function setNumberThrowsExceptionWhenExceedMaximumValue() - { - $number = str_pad('x', 25, 'x'); - $result = $this->authorization->setNumber($number); - - $this->assertNull($result); - } -} diff --git a/tests/Common/Base/BankAccountTest.php b/tests/Common/Base/BankAccountTest.php deleted file mode 100644 index 7737132..0000000 --- a/tests/Common/Base/BankAccountTest.php +++ /dev/null @@ -1,235 +0,0 @@ - - */ -class BankAccountTest extends TestCase -{ - use ChangeProtectedAttribute; - use Mock; - - /** - * @var BankAccount - */ - private $bank; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() - { - parent::setUp(); - - $this->bank = new BankAccount( - $this->bankMock(), - $this->holderMock() - ); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() - { - $this->bank = null; - - parent::tearDown(); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::getNumber() - */ - public function getNumberReturnAccountAttribute() - { - $account = 332; - - $this->modifyAttribute($this->bank, 'account', $account); - - $this->assertEquals($account, $this->bank->getNumber()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::getDigit() - */ - public function getDigitReturnAccountDigitAttribute() - { - $digit = 03; - - $this->modifyAttribute($this->bank, 'accountDigit', $digit); - - $this->assertEquals($digit, $this->bank->getDigit()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::getOperation() - */ - public function getOperationReturnAccountOperationAttribute() - { - $operation = 013; - - $this->modifyAttribute($this->bank, 'accountOperation', $operation); - - $this->assertEquals($operation, $this->bank->getOperation()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::getBank() - */ - public function getBankReturnBankAttribute() - { - $bank = $this->bankMock(); - - $this->modifyAttribute($this->bank, 'bank', $bank); - - $this->assertEquals($bank, $this->bank->getBank()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::getSecurity() - */ - public function getSecurityReturnSecurityAttribute() - { - $security = 'N'; - - $this->modifyAttribute($this->bank, 'security', $security); - - $this->assertEquals($security, $this->bank->getSecurity()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::getHolder() - */ - public function getHolderReturnHolderAttribute() - { - $holder = $this->holderMock(); - - $this->modifyAttribute($this->bank, 'holder', $holder); - - $this->assertEquals($holder, $this->bank->getHolder()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::setNumber() - */ - public function setNumberReturnNull() - { - $this->assertNull($this->bank->setNumber(233)); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::setNumber() - * @expectedException \InvalidArgumentException - */ - public function setNumberThrowsExceptionWhenReceiveNotNumberValue() - { - $this->assertNull($this->bank->setNumber('XDS')); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::setDigit() - */ - public function setDigitReturnNull() - { - $this->assertNull($this->bank->setDigit(233)); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::setDigit() - * @expectedException \InvalidArgumentException - */ - public function setDigitThrowsExceptionWhenReceiveNotNumberValue() - { - $this->assertNull($this->bank->setDigit('XDE')); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::setOperation() - */ - public function setOperationReturnNull() - { - $this->assertNull($this->bank->setOperation(233)); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::setOperation() - * @expectedException \InvalidArgumentException - */ - public function setOperationThrowsExceptionWhenReceiveNotNumberValue() - { - $this->assertNull($this->bank->setOperation('XDS')); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::setSecurity() - */ - public function setSecurityReturnNull() - { - $this->assertNull($this->bank->setSecurity(true)); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::setSecurity() - * @expectedException \InvalidArgumentException - */ - public function setSecurityThrowsExceptionWhenReceiveNotBooleanValue() - { - $this->assertNull($this->bank->setSecurity('S')); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::setBank() - */ - public function setBankReturnNull() - { - $this->assertNull($this->bank->setBank($this->bankMock())); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\BankAccount::setHolder() - */ - public function setHolderReturnNull() - { - $this->assertNull($this->bank->setHolder($this->holderMock())); - } -} diff --git a/tests/Common/Base/BankTest.php b/tests/Common/Base/BankTest.php deleted file mode 100644 index 2dad200..0000000 --- a/tests/Common/Base/BankTest.php +++ /dev/null @@ -1,148 +0,0 @@ - - */ -class BankTest extends TestCase -{ - use ChangeProtectedAttribute; - - /** - * @var Bank - */ - private $bank; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() - { - parent::setUp(); - - $this->bank = new Bank(); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() - { - $this->bank = null; - - parent::tearDown(); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Bank::getAgency() - */ - public function getAgencyReturnAgencyAttribute() - { - $agency = 55; - - $this->modifyAttribute($this->bank, 'agency', $agency); - - $this->assertEquals($agency, $this->bank->getAgency()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Bank::setAgency() - */ - public function setAgencyReturnNull() - { - $this->assertNull($this->bank->setAgency(55)); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Bank::setAgency() - * @expectedException \InvalidArgumentException - */ - public function setAgencyThrowsExceptionWhenNotNumericValue() - { - $this->assertNull($this->bank->setAgency('SS')); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Bank::getDigit() - */ - public function getDigitReturnDigitAttribute() - { - $agency = 55; - - $this->modifyAttribute($this->bank, 'digit', $agency); - - $this->assertEquals($agency, $this->bank->getDigit()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Bank::setDigit() - */ - public function setDigitReturnNull() - { - $this->assertNull($this->bank->setDigit(45)); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Bank::setDigit() - * @expectedException \InvalidArgumentException - */ - public function setDigitThrowsExceptionWhenNotNumericValue() - { - $this->assertNull($this->bank->setDigit('AS')); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Bank::getCode() - */ - public function getCodeMustBeReturnCodeAttribute() - { - $this->modifyAttribute($this->bank, 'code', Bank::SICRED); - - $this->assertEquals(Bank::SICRED, $this->bank->getCode()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Bank::setCode() - */ - public function setCodeMustBeReturnNull() - { - $result = $this->bank->setCode(Bank::SICRED); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Bank::setCode() - * @expectedException \InvalidArgumentException - */ - public function setCodeMustBeThrowsExceptionWhenReceiveStringName() - { - $this->bank->setCode('Banco do Brasil'); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Bank::setCode() - * @expectedException \InvalidArgumentException - */ - public function setCodeMustBeThrowsExceptionWhenReceiveInvalidCode() - { - $this->bank->setCode(0); - } -} diff --git a/tests/Common/Base/BilletTest.php b/tests/Common/Base/BilletTest.php deleted file mode 100644 index cdc352d..0000000 --- a/tests/Common/Base/BilletTest.php +++ /dev/null @@ -1,193 +0,0 @@ - - */ -class BilletTest extends TestCase -{ - use ChangeProtectedAttribute; - use Mock; - - /** - * @var Billet - */ - private $billet; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() - { - parent::setUp(); - - $this->billet = new Billet(); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() - { - $this->billet = null; - - parent::tearDown(); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Billet::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Billet::getDetails() - */ - public function getDetailsReturnDetailsAttribute() - { - $this->assertInstanceOf(\ArrayObject::class, $this->billet->getDetails()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Billet::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Billet::setDetails() - */ - public function setDetailsMustBeReturnNull() - { - $result = $this->billet->setDetails(new \ArrayObject()); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Billet::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Billet::addDetail() - */ - public function addDetailMustBeReturnNull() - { - $detail = new Detail( - $this->customerMock(), - $this->chargeMock(), - $this->sellerMock(), - $this->purchaserMock(), - $this->parcelsMock(), - $this->authorizationMock(), - $this->billetMock(), - $this->sequenceMock() - ); - - $result = $this->billet->addDetail($detail); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Billet::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Billet::getRate() - */ - public function getRateReturnRatesAttribute() - { - $rate = 1; - - $this->modifyAttribute($this->billet, 'rate', $rate); - - $this->assertEquals($rate, $this->billet->getRate()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Billet::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Billet::setRate() - */ - public function setRateMustBeReturnNull() - { - $result = $this->billet->setRate(1); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Billet::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Billet::getBankAccount() - */ - public function getBankAccountReturnBankaccountsAttribute() - { - $bankaccount = $this->bankAccountMock(); - - $this->modifyAttribute($this->billet, 'bankAccount', $bankaccount); - - $this->assertEquals($bankaccount, $this->billet->getBankAccount()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Billet::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Billet::setBankAccount() - */ - public function setBankAccountMustBeReturnNull() - { - $result = $this->billet->setBankAccount($this->bankAccountMock()); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Billet::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Billet::getAssignor() - */ - public function getAssignorReturnAssignorsAttribute() - { - $assignor = $this->sellerMock(); - - $this->modifyAttribute($this->billet, 'assignor', $assignor); - - $this->assertEquals($assignor, $this->billet->getAssignor()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Billet::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Billet::setAssignor() - */ - public function setAssignorMustBeReturnNull() - { - $result = $this->billet->setAssignor($this->sellerMock()); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Billet::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Billet::getNumber() - */ - public function getNumberReturnNumbersAttribute() - { - $number = 1; - - $this->modifyAttribute($this->billet, 'number', 1); - - $this->assertEquals(1, $this->billet->getNumber()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Billet::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Billet::setNumber() - */ - public function setNumberMustBeReturnNull() - { - $result = $this->billet->setNumber(1); - - $this->assertNull($result); - } -} diff --git a/tests/Common/Base/CartTest.php b/tests/Common/Base/CartTest.php deleted file mode 100644 index e87ec6c..0000000 --- a/tests/Common/Base/CartTest.php +++ /dev/null @@ -1,83 +0,0 @@ - - */ -class CartTest extends TestCase -{ - use ChangeProtectedAttribute; - - /** - * @var Cart - */ - private $cart; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() - { - parent::setUp(); - - $item = m::mock(Detail::class); - - $this->cart = new Cart([$item]); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() - { - $this->cart = null; - - parent::tearDown(); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Cart::addItem() - */ - public function addItem() - { - $item = m::mock(Detail::class); - - $result = $this->cart->addItem($item); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Cart::removeItem() - */ - public function removeItem() - { - $item = 0; - $result = $this->cart->removeItem($item); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Cart::removeItem() - * @expectedException \InvalidArgumentException - */ - public function removeItemAbsentThrowsException() - { - $item = 1; - $result = $this->cart->removeItem($item); - - $this->assertNull($result); - } -} diff --git a/tests/Common/Base/ChargeTest.php b/tests/Common/Base/ChargeTest.php deleted file mode 100644 index 4019b78..0000000 --- a/tests/Common/Base/ChargeTest.php +++ /dev/null @@ -1,97 +0,0 @@ - - */ -class ChargeTest extends TestCase -{ - use ChangeProtectedAttribute; - use Mock; - - /** - * @var Charge - */ - private $charge; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() - { - parent::setUp(); - - $this->charge = new Charge(); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() - { - $this->charge = null; - - parent::tearDown(); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Charge::getCharging() - */ - public function getChargingReturnChargingAttribute() - { - $charging = Charge::ENERGY; - - $this->modifyAttribute($this->charge, 'charging', $charging); - - $this->assertEquals($charging, $this->charge->getCharging()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Charge::setCharging() - */ - public function setChargingReturnNull() - { - $this->assertNull($this->charge->setCharging(Charge::ENERGY)); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Charge::setCharging() - * @expectedException \InvalidArgumentException - */ - public function setChargingThrowsExceptionWhenNotValidChargingType() - { - $this->assertNull($this->charge->setCharging('CC')); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Charge::getOccurrence() - */ - public function getOccurrenceReturnOccurrenceAttribute() - { - $occurrence = 'I'; - - $this->modifyAttribute($this->charge, 'occurrence', $occurrence); - - $this->assertEquals($occurrence, $this->charge->getOccurrence()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Charge::setOccurrence() - */ - public function setOccurrenceReturnNull() - { - $this->assertNull($this->charge->setOccurrence($this->occurrenceMock())); - } -} diff --git a/tests/Common/Base/ClientTest.php b/tests/Common/Base/ClientTest.php deleted file mode 100644 index d7d6520..0000000 --- a/tests/Common/Base/ClientTest.php +++ /dev/null @@ -1,78 +0,0 @@ - - */ -class ClientTest extends TestCase -{ - use ChangeProtectedAttribute; - - /** - * @var Client - */ - private $client; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() - { - parent::setUp(); - - $this->client = new Client(); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() - { - $this->client = null; - - parent::tearDown(); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Client::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Client::getCode() - */ - public function getCodeReturnCodeAttribute() - { - $this->modifyAttribute($this->client, 'code', 1); - - $this->assertEquals($this->client->getCode(), 1); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Client::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Client::setCode() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Client::getCode() - */ - public function setCodeChangeCodeAttribute() - { - $this->client->setCode(1); - - $this->assertEquals($this->client->getCode(), 1); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Client::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Client::setCode() - * @expectedException InvalidArgumentException - */ - public function setCodeOnlyAcceptIntegerValue() - { - $this->client->setCode('A'); - } -} diff --git a/tests/Common/Base/ConsumerUnityTest.php b/tests/Common/Base/ConsumerUnityTest.php deleted file mode 100644 index 516e079..0000000 --- a/tests/Common/Base/ConsumerUnityTest.php +++ /dev/null @@ -1,161 +0,0 @@ - - */ -class ConsumerUnityTest extends TestCase -{ - use ChangeProtectedAttribute; - - /** - * @var ConsumerUnity - */ - private $unity; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() - { - parent::setUp(); - - $this->unity = new ConsumerUnity(); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() - { - $this->unity = null; - - parent::tearDown(); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\ConsumerUnity::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\ConsumerUnity::getNumber() - */ - public function getNumberReturnNumberAttribute() - { - $number = rand(); - - $this->modifyAttribute($this->unity, 'number', $number); - - $this->assertEquals($number, $this->unity->getNumber()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\ConsumerUnity::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\ConsumerUnity::setNumber() - */ - public function setNumberReturnNull() - { - $this->assertNull($this->unity->setNumber(rand())); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\ConsumerUnity::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\ConsumerUnity::setNumber() - * @expectedException \InvalidArgumentException - */ - public function setNumberThrowsExceptionWhenEmpty() - { - $this->assertNull($this->unity->setNumber('')); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\ConsumerUnity::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\ConsumerUnity::getRead() - */ - public function getReadReturnReadAttribute() - { - $read = new \DateTime(); - - $this->modifyAttribute($this->unity, 'read', $read); - - $this->assertSame($read, $this->unity->getRead()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\ConsumerUnity::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\ConsumerUnity::setRead() - */ - public function setReadReturnNull() - { - $this->assertNull($this->unity->setRead(new \DateTime())); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\ConsumerUnity::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\ConsumerUnity::getMaturity() - */ - public function getMaturityReturnMaturityAttribute() - { - $read = new \DateTime(); - - $this->modifyAttribute($this->unity, 'maturity', $read); - - $this->assertSame($read, $this->unity->getMaturity()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\ConsumerUnity::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\ConsumerUnity::setMaturity() - */ - public function setMaturityReturnNull() - { - $this->assertNull($this->unity->setMaturity(new \DateTime())); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Consumerunity::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Consumerunity::getCode() - */ - public function getCodeReturnCodeAttribute() - { - $this->modifyAttribute($this->unity, 'code', 1); - - $this->assertEquals($this->unity->getCode(), 1); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Consumerunity::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Consumerunity::setCode() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Consumerunity::getCode() - */ - public function setCodeChangeCodeAttribute() - { - $this->unity->setCode(1); - - $this->assertEquals($this->unity->getCode(), 1); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Consumerunity::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Consumerunity::setCode() - * @expectedException InvalidArgumentException - */ - public function setCodeOnlyAcceptIntegerValue() - { - $this->unity->setCode('A'); - } -} diff --git a/tests/Common/Base/CreditCardTest.php b/tests/Common/Base/CreditCardTest.php deleted file mode 100644 index ea24d81..0000000 --- a/tests/Common/Base/CreditCardTest.php +++ /dev/null @@ -1,211 +0,0 @@ - - */ -class CreditCardTest extends TestCase -{ - use ChangeProtectedAttribute; - - /** - * @var CreditCard - */ - private $card; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() - { - parent::setUp(); - - $this->card = new CreditCard(); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() - { - parent::tearDown(); - } - - /** - * @return array - */ - public function loadCardsProvider() - { - return [ - [ - [ - 'number' => '4012001037141112', - 'validate' => '201512', - 'security' => '123', - 'flag' => 68 - ] - ] - ]; - - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\CreditCard::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\CreditCard::getNumber() - */ - public function getNumberReturnNumberAttribute() - { - $this->modifyAttribute($this->card, 'number', 1); - - $this->assertEquals(1, $this->card->getNumber()); - } - - /** - * @test - * @dataProvider loadCardsProvider - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\CreditCard::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\CreditCard::setNumber() - */ - public function setNumberReturnNull($card) - { - $this->assertNull($this->card->setNumber($card['number'])); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\CreditCard::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\CreditCard::setNumber() - * @expectedException \InvalidArgumentException - */ - public function setNumberThrowsExceptionWhenNotValidCard() - { - $this->card->setNumber('333232'); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\CreditCard::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\CreditCard::setNumber() - * @expectedException \InvalidArgumentException - */ - public function setNumberThrowsExceptionWhenEmpty() - { - $this->card->setNumber(''); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\CreditCard::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\CreditCard::setNumber() - * @expectedException \InvalidArgumentException - */ - public function setNumberThrowsExceptionWhenNotNumericValue() - { - $this->card->setNumber('938SDS@'); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\CreditCard::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\CreditCard::getValidate() - */ - public function getValidateMustBeReturnCreditCardValidateAttribute() - { - $validate = new DateTime(); - - $this->modifyAttribute($this->card, 'validate', $validate); - - $this->assertSame($validate, $this->card->getValidate()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\CreditCard::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\CreditCard::setValidate() - */ - public function setValidateMustBeReturnNull() - { - $this->assertNull($this->card->setValidate(new DateTime())); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\CreditCard::__construct - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\CreditCard::getSecurityNumber - */ - public function getSecurityNumberMustBeReturnCreditCardSecurityNumberAttribute() - { - $this->modifyAttribute($this->card, 'security', 232); - - $this->assertSame(232, $this->card->getSecurityNumber()); - } - - /** - * @test - * @dataProvider loadCardsProvider - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\CreditCard::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\CreditCard::setSecurityNumber() - */ - public function setSecurityNumberMustBeReturnNull($card) - { - $this->assertNull($this->card->setSecurityNumber($card['security'])); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\CreditCard::__construct - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\CreditCard::setSecurityNumber - * @expectedException \InvalidArgumentException - */ - public function setSecurityNumberrThrowsExceptionNotNumericValue() - { - $this->card->setSecurityNumber('SDS'); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\CreditCard::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\CreditCard::getFlag() - */ - public function getFlagMustBeReturnFlagAttribute() - { - $this->modifyAttribute($this->card, 'flag', CreditCard::VISA); - - $this->assertEquals(CreditCard::VISA, $this->card->getFlag()); - } - - /** - * @test - * @dataProvider loadCardsProvider - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\CreditCard::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\CreditCard::setFlag() - */ - public function setFlagMustBeReturnNull($card) - { - $result = $this->card->setFlag($card['flag']); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\CreditCard::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\CreditCard::setFlag() - * @expectedException \InvalidArgumentException - */ - public function setFlagMustBeReturnThrowsExceptionWhenEmpty() - { - $result = $this->card->setFlag('Mastercard'); - - $this->assertNull($result); - } -} diff --git a/tests/Common/Base/CustomerTest.php b/tests/Common/Base/CustomerTest.php deleted file mode 100644 index 54a76cf..0000000 --- a/tests/Common/Base/CustomerTest.php +++ /dev/null @@ -1,233 +0,0 @@ - - */ -class CustomerTest extends TestCase -{ - use ChangeProtectedAttribute; - - /** - * @var Customer - */ - private $customer; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() - { - parent::setUp(); - - $this->customer = new Customer(); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() - { - $this->customer = null; - - parent::tearDown(); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Customer::getCode() - */ - public function getCodeReturnCodeAttribute() - { - $this->modifyAttribute($this->customer, 'code', 1); - - $this->assertEquals($this->customer->getCode(), 1); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Customer::setCode() - */ - public function setCodeMustBeReturnNullWhenReceiveIntegerValue() - { - $this->assertNull($this->customer->setCode(1)); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Customer::setCode() - */ - public function setCodeMustBeReturnNullWhenReceiveNotNumericValue() - { - $this->assertNull($this->customer->setCode('A')); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Customer::setCode() - * @expectedException \InvalidArgumentException - */ - public function setCodeOnlyThrowsExceptionWhenEmpty() - { - $this->customer->setCode(''); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Customer::setCode() - */ - public function setCodeMustBeReturnNullWhenReceiveFloatValue() - { - $this->assertNull($this->customer->setCode(7.9837)); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Customer::getIdentityNumber() - */ - public function getIdentityNumberReturnIdentityNumberAttribute() - { - $this->modifyAttribute($this->customer, 'identityNumber', 1); - - $this->assertEquals($this->customer->getIdentityNumber(), 1); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Customer::setIdentityNumber() - */ - public function setIdentityNumberReturnNullWhenReceiveNumericValue() - { - $this->assertNull($this->customer->setIdentityNumber(1)); - $this->assertNull($this->customer->setIdentityNumber(1.5)); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Customer::setIdentityNumber() - */ - public function setIdentityNumberMustBeNonNumericValue() - { - $result = $this->customer->setIdentityNumber('A'); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Customer::setIdentityNumber() - */ - public function setIdentityNumberMustBeEmpty() - { - $result = $this->customer->setIdentityNumber(''); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Customer::getWorkingDays() - */ - public function getWorkingDaysReturnWorkingDaysAttribute() - { - $this->modifyAttribute($this->customer, 'workingDays', 1); - - $this->assertEquals($this->customer->getWorkingDays(), 1); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Customer::setWorkingDays() - */ - public function setWorkingDaysReturnNullWhenReceiveNumericValue() - { - $this->assertNull($this->customer->setWorkingDays(1)); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Customer::setWorkingDays() - * @expectedException \InvalidArgumentException - */ - public function setWorkingDaysThrowsExceptionWhenNotNumericValue() - { - $this->customer->setWorkingDays('A'); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Customer::setWorkingDays() - * @expectedException \InvalidArgumentException - */ - public function setWorkingDaysThrowsExceptionWhenEmpty() - { - $this->customer->setWorkingDays(''); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Customer::setWorkingDays() - * @expectedException \InvalidArgumentException - */ - public function setWorkingDaysThrowsExceptionWhenNotInteger() - { - $this->customer->setWorkingDays(5.43); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Customer::getHelpfulMaturity() - */ - public function getHelpfulMaturityReturnHelpfulMaturityAttribute() - { - $this->modifyAttribute($this->customer, 'helpfulMaturity', true); - - $this->assertTrue($this->customer->getHelpfulMaturity()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Customer::setHelpfulMaturity() - */ - public function setHelpfulMaturityReturnNullWhenReceiveBooleanValue() - { - $this->assertNull($this->customer->setHelpfulMaturity(true)); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Customer::setHelpfulMaturity() - * @expectedException \InvalidArgumentException - */ - public function setHelpfulMaturityThrowsExceptionWhenNotBooleanValue() - { - $this->customer->setHelpfulMaturity('A'); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Customer::setHelpfulMaturity() - * @expectedException \InvalidArgumentException - */ - public function setHelpfulMaturityThrowsExceptionWhenReceiveEmpty() - { - $this->customer->setHelpfulMaturity(''); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Customer::setHelpfulMaturity() - * @expectedException \InvalidArgumentException - */ - public function setHelpfulMaturityThrowsExceptionWhenNumeric() - { - $this->customer->setHelpfulMaturity(5.43); - } -} diff --git a/tests/Common/Base/DealershipTest.php b/tests/Common/Base/DealershipTest.php deleted file mode 100644 index 61df707..0000000 --- a/tests/Common/Base/DealershipTest.php +++ /dev/null @@ -1,100 +0,0 @@ - - */ -class DealershipTest extends TestCase -{ - use ChangeProtectedAttribute; - - /** - * @var Dealership - */ - private $dealership; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() - { - parent::setUp(); - - $this->dealership = new Dealership(); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() - { - parent::tearDown(); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Dealership::getCode() - */ - public function getCodeReturnCodeAttribute() - { - $this->modifyAttribute($this->dealership, 'code', 1); - - $this->assertEquals(1, $this->dealership->getCode()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Dealership::setCode() - */ - public function setCodeMustBeReturnNull() - { - $this->assertNull($this->dealership->setCode('1')); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Dealership::setCode() - * @expectedException \InvalidArgumentException - */ - public function setCodeThrowsExceptionWhenExceedMaxLengh() - { - $this->assertNull($this->dealership->setCode('999999999')); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Dealership::getName() - */ - public function getNameReturnNameAttribute() - { - $this->modifyAttribute($this->dealership, 'name', 1); - - $this->assertEquals(1, $this->dealership->getName()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Dealership::setName() - */ - public function setNameMustBeReturnNull() - { - $this->assertNull($this->dealership->setName('1')); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Dealership::setName() - * @expectedException \InvalidArgumentException - */ - public function setNameThrowsExceptionWhenEmpty() - { - $this->assertNull($this->dealership->setName('')); - } -} diff --git a/tests/Common/Base/DocumentTest.php b/tests/Common/Base/DocumentTest.php deleted file mode 100644 index b7711d7..0000000 --- a/tests/Common/Base/DocumentTest.php +++ /dev/null @@ -1,128 +0,0 @@ - - */ -class DocumentTest extends TestCase -{ - use ChangeProtectedAttribute; - - /** - * @var Document - */ - private $document; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() - { - parent::setUp(); - - $this->document = new Document(); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() - { - parent::tearDown(); - - $this->document = null; - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Document::__construct - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Document::getType - */ - public function getTypeMustBeReturnTypeAttribute() - { - $this->modifyAttribute($this->document, 'type', 2); - - $this->assertEquals(2, $this->document->getType()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Document::__construct - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Document::setType - */ - public function setTypeOnlyAcceptPreDefinedTypes() - { - $types = [Document::CNPJ, Document::CPF]; - $type = $types[ array_rand($types) ]; - - $result = $this->document->setType($type); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Document::__construct - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Document::setType - * @expectedException \InvalidArgumentException - */ - public function setTypeThrowsExceptionWhenInvalidtype() - { - $this->document->setType('PASSPORT'); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Document::__construct - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Document::setType - * @expectedException \InvalidArgumentException - */ - public function setTypeThrowsExceptionWhenEmptyValue() - { - $this->document->setType(''); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Document::__construct - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Document::getNumber - */ - public function getNumberMustBeReturnNumberAttribute() - { - $this->modifyAttribute($this->document, 'number', 2); - - $this->assertEquals(2, $this->document->getNumber()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Document::__construct - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Document::setNumber - */ - public function setNumberMustBeReturnNull() - { - $result = $this->document->setNumber('11122233344'); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Document::__construct - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Document::setNumber - * @expectedException \InvalidArgumentException - */ - public function setNumberThrowsExceptionWhenExceedMaxLength() - { - $result = $this->document->setNumber(str_pad(0, 20, 0)); - - $this->assertNull($result); - } -} diff --git a/tests/Common/Base/EmailTest.php b/tests/Common/Base/EmailTest.php deleted file mode 100644 index b012931..0000000 --- a/tests/Common/Base/EmailTest.php +++ /dev/null @@ -1,135 +0,0 @@ - - */ -class EmailTest extends TestCase -{ - use ChangeProtectedAttribute; - use Mock; - - /** - * @var Email - */ - private $email; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() - { - parent::setUp(); - - $this->email = new Email('foo@foo.net'); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() - { - $this->email = null; - - parent::tearDown(); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Email::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Email::getAddress() - */ - public function getAddressReturnAddressAttribute() - { - $address = 'foo@foo.net'; - - $this->modifyAttribute($this->email, 'address', $address); - - $this->assertEquals($address, $this->email->getAddress()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Email::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Email::setAddress() - */ - public function setAddressReturnNull() - { - $address = 'foo@foo.net'; - - $result = $this->email->setAddress($address); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Email::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Email::setAddress() - * @expectedException \InvalidArgumentException - */ - public function setAddressThrowsExceptionWhenAddressIsInvalid() - { - $address = '1234'; - - $result = $this->email->setAddress($address); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Email::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Email::getPrimary() - */ - public function getPrimaryReturnPrimaryAttribute() - { - $this->modifyAttribute($this->email, 'primary', true); - - $this->assertEquals(true, $this->email->getPrimary()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Email::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Email::isPrimary() - */ - public function isPrimaryReturnPrimaryAttribute() - { - $this->modifyAttribute($this->email, 'primary', true); - - $this->assertEquals(true, $this->email->isPrimary()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Email::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Email::setPrimary() - */ - public function setPrimaryReturnNull() - { - $result = $this->email->setPrimary(true); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Email::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Email::setPrimary() - * @expectedException \InvalidArgumentException - */ - public function setPrimaryThrowsExceptionPrimaryIsNotBoolean() - { - $result = $this->email->setPrimary('true'); - - $this->assertNull($result); - } -} diff --git a/tests/Common/Base/HolderTest.php b/tests/Common/Base/HolderTest.php deleted file mode 100644 index 4e59998..0000000 --- a/tests/Common/Base/HolderTest.php +++ /dev/null @@ -1,92 +0,0 @@ - - */ -class HolderTest extends TestCase -{ - use ChangeProtectedAttribute; - - /** - * @var Holder - */ - private $holder; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() - { - parent::setUp(); - - $this->holder = new Holder(); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() - { - $this->holder = null; - - parent::tearDown(); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Holder::getCode() - */ - public function getCodeReturnCodeAttribute() - { - $this->modifyAttribute($this->holder, 'code', 1); - - $this->assertEquals($this->holder->getCode(), 1); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Holder::setCode() - */ - public function setCodeMustBeReturnNullWhenReceiveIntegerValue() - { - $this->assertNull($this->holder->setCode(1)); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Holder::setCode() - * @expectedException \InvalidArgumentException - */ - public function setCodeThrowsExceptionWhenNotNumericValue() - { - $this->holder->setCode('A'); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Holder::setCode() - * @expectedException \InvalidArgumentException - */ - public function setCodeOnlyThrowsExceptionWhenEmpty() - { - $this->holder->setCode(''); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Holder::setCode() - * @expectedException \InvalidArgumentException - */ - public function setCodeOnlyThrowsExceptionWhenNotIntegerValue() - { - $this->holder->setCode(7.9837); - } -} diff --git a/tests/Common/Base/OccurrenceTest.php b/tests/Common/Base/OccurrenceTest.php deleted file mode 100644 index 4d63526..0000000 --- a/tests/Common/Base/OccurrenceTest.php +++ /dev/null @@ -1,226 +0,0 @@ - - */ -class OccurrenceTest extends TestCase -{ - use ChangeProtectedAttribute; - - /** - * @var Occurrence - */ - private $occurrence; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() - { - parent::setUp(); - - $this->occurrence = new Occurrence(); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() - { - parent::tearDown(); - - $this->occurrence = null; - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Occurrence::getType() - */ - public function getTypeMustBeReturnTypeAttribute() - { - $types = [Occurrence::CANCEL, Occurrence::INSERT, Occurrence::UPDATE]; - $type = $types[ array_rand($types) ]; - - $this->modifyAttribute($this->occurrence, 'type', $type); - - $this->assertEquals($type, $this->occurrence->getType()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Occurrence::setType() - */ - public function setTypeOnlyAcceptPreDefinedTypes() - { - $types = [Occurrence::CANCEL, Occurrence::INSERT, Occurrence::UPDATE]; - $type = $types[ array_rand($types) ]; - - $result = $this->occurrence->setType($type); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Occurrence::setType() - * @expectedException \InvalidArgumentException - */ - public function setTypeThrowsExceptionWhenNotPredefinedTypes() - { - $type = 'X'; - - $this->occurrence->setType($type); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Occurrence::setType() - * @expectedException \InvalidArgumentException - */ - public function setTypeThrowsExceptionWhenEmpty() - { - $type = ' '; - - $this->occurrence->setType($type); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Occurrence::getReturn() - */ - public function getReturnMustBeReturnReturnAttribute() - { - $this->modifyAttribute($this->occurrence, 'return', 1); - - $this->assertEquals(1, $this->occurrence->getReturn()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Occurrence::setReturn() - */ - public function setReturnMustBeReturnNullWhenReceiveNumericValue() - { - $this->assertNull($this->occurrence->setReturn(1)); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Occurrence::setReturn() - */ - public function setReturnMustBeReturnNullWhenNotReceiveAnyParameter() - { - $this->assertNull($this->occurrence->setReturn()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Occurrence::setReturn() - * @expectedException \InvalidArgumentException - */ - public function setReturnThrowsExceptionWhenReceiveNonNumericValue() - { - $type = 'X'; - - $this->occurrence->setReturn($type); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Occurrence::setReturn() - * @expectedException \InvalidArgumentException - */ - public function setReturnThrowsExceptionWhenReceiveEmptyValue() - { - $this->assertNull($this->occurrence->setReturn('')); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Occurrence::setReturn() - */ - public function setReturnReturnNullWhenReceiveNumericAsStringValue() - { - $this->assertNull($this->occurrence->setReturn('4')); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Occurrence::setDescription() - */ - public function setDescriptionMustBeReturnNullWhenReceiveStringValue() - { - $this->assertNull($this->occurrence->setDescription('foo')); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Occurrence::getDescription() - */ - public function getDescriptionMustBeReturnDescriptionAttribute() - { - $this->modifyAttribute($this->occurrence, 'description', 'foo'); - - $this->assertEquals('foo', $this->occurrence->getDescription()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Occurrence::setDescription() - */ - public function setDescriptionReturnNullWhenReceiveEmptyValue() - { - $this->assertNull($this->occurrence->setDescription('')); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Occurrence::setDescription() - */ - public function setDescriptionReturnNullWhenNotReceiveAnyParameter() - { - $this->assertNull($this->occurrence->setDescription()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Occurrence::setDescription() - * @expectedException \InvalidArgumentException - */ - public function setDescriptionThrowsExceptionWhenNotReceiveNotString() - { - $this->assertNull($this->occurrence->setDescription(33)); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Occurrence::getDate() - */ - public function getDateMustBeReturnDateAttribute() - { - $date = new \DateTime(); - $this->modifyAttribute($this->occurrence, 'date', $date); - - $this->assertSame($date, $this->occurrence->getDate()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Occurrence::setDate() - */ - public function setDateMustBeReturnNull() - { - $date = new \DateTime(); - - $result = $this->occurrence->setDate($date); - - $this->assertNull($result); - } -} diff --git a/tests/Common/Base/ParcelTest.php b/tests/Common/Base/ParcelTest.php deleted file mode 100644 index 1a3ffa4..0000000 --- a/tests/Common/Base/ParcelTest.php +++ /dev/null @@ -1,179 +0,0 @@ - - */ -class ParcelTest extends TestCase -{ - use ChangeProtectedAttribute; - - /** - * @var Parcel - */ - private $parcel; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() - { - parent::setUp(); - - $this->parcel = new Parcel(); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() - { - $this->parcel = null; - - parent::tearDown(); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Parcel::getMaturity() - */ - public function getMaturity() - { - $maturity = new DateTime(); - - $this->modifyAttribute($this->parcel, 'maturity', $maturity); - - $this->assertSame($maturity, $this->parcel->getMaturity()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Parcel::setMaturity() - */ - public function setMaturity() - { - $result = $this->parcel->setMaturity(new DateTime()); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Parcel::getPrice() - */ - public function getPrice() - { - $price = 1.00; - - $this->modifyAttribute($this->parcel, 'price', $price); - - $this->assertEquals($price, $this->parcel->getPrice()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Parcel::setPrice() - */ - public function setPrice() - { - $result = $this->parcel->setPrice(1); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Parcel::setPrice() - * @expectedException \InvalidArgumentException - */ - public function setPriceThrowsExceptionWhenReceiveNotNumericValue() - { - $this->parcel->setPrice('SD'); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Parcel::getKey() - */ - public function getKey() - { - $parcel = 1; - - $this->modifyAttribute($this->parcel, 'key', $parcel); - - $this->assertEquals($parcel, $this->parcel->getKey()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Parcel::setKey() - */ - public function setKey() - { - $result = $this->parcel->setKey(1); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Parcel::setKey() - * @expectedException \InvalidArgumentException - */ - public function setKeyThrowsExceptionWhenReceiveNotNumericValue() - { - $this->parcel->setKey('SD'); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Parcel::getQuantity() - */ - public function getQuantity() - { - $quantity = 1.00; - - $this->modifyAttribute($this->parcel, 'quantity', $quantity); - - $this->assertEquals($quantity, $this->parcel->getQuantity()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Parcel::setQuantity() - */ - public function setQuantity() - { - $result = $this->parcel->setQuantity(1); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Parcel::setQuantity() - * @expectedException \InvalidArgumentException - */ - public function setQuantityThrowsExceptionWhenReceiveNotNumericValue() - { - $this->parcel->setQuantity('SD'); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Parcel::setQuantity() - * @expectedException \InvalidArgumentException - */ - public function setQuantityThrowsExceptionWhenReceiveEmptyValue() - { - $this->parcel->setQuantity(''); - } -} diff --git a/tests/Common/Base/ParcelsTest.php b/tests/Common/Base/ParcelsTest.php deleted file mode 100644 index da15b20..0000000 --- a/tests/Common/Base/ParcelsTest.php +++ /dev/null @@ -1,54 +0,0 @@ - - */ -class ParcelsTest extends TestCase -{ - use ChangeProtectedAttribute; - use Mock; - - /** - * @var Parcels - */ - private $parcels; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() - { - parent::setUp(); - - $this->parcels = new Parcels(4); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() - { - $this->parcels = null; - - parent::tearDown(); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Parcels::__construct - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Parcels::addParcel - */ - public function addParcelMustReturnNullWhenReceiveParcelObject() - { - $this->assertNull($this->parcels->addParcel($this->parcelMock())); - } -} diff --git a/tests/Common/Base/PersonTest.php b/tests/Common/Base/PersonTest.php deleted file mode 100644 index b94d83d..0000000 --- a/tests/Common/Base/PersonTest.php +++ /dev/null @@ -1,374 +0,0 @@ - - */ -class PersonTest extends TestCase -{ - use ChangeProtectedAttribute; - use Mock; - - /** - * @var Person - */ - private $person; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() - { - parent::setUp(); - - $this->person = new Person(); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() - { - $this->person = null; - - parent::tearDown(); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::getDocument() - */ - public function getDocumentReturnDocumentAttribute() - { - $document = $this->documentMock(); - - $this->modifyAttribute($this->person, 'document', $document); - - $this->assertSame($document, $this->person->getDocument()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::setDocument() - */ - public function setDocumentReturnEmpty() - { - $document = $this->documentMock(); - - $this->assertNull($this->person->setDocument($document)); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::getHomePhone() - */ - public function getHomePhoneReturnHomePhoneAttribute() - { - $telephone = $this->phoneMock(); - - $this->modifyAttribute($this->person, 'homePhone', $telephone); - - $this->assertSame($telephone, $this->person->getHomePhone()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::setHomePhone() - */ - public function setHomePhoneReturnEmpty() - { - $telephone = $this->phoneMock(); - - $result = $this->person->setHomePhone($telephone); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::getHomePhoneSecondary() - */ - public function getHomePhoneSecondaryReturnHomePhoneSecondaryAttribute() - { - $telephone = $this->phoneMock(); - - $this->modifyAttribute($this->person, 'homePhoneSecondary', $telephone); - - $this->assertSame($telephone, $this->person->getHomePhoneSecondary()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::setHomePhoneSecondary() - */ - public function setHomePhoneSecondaryReturnEmpty() - { - $telephone = $this->phoneMock(); - - $result = $this->person->setHomePhoneSecondary($telephone); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::getName() - */ - public function getNameReturnNameAttribute() - { - $this->modifyAttribute($this->person, 'name', 'foo'); - - $this->assertEquals('foo', $this->person->getName()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::setName() - */ - public function setNameReturnEmpty() - { - $result = $this->person->setName('foo'); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::getEmail() - */ - public function getEmailReturnEmailAttribute() - { - $email = $this->emailMock(); - - $this->modifyAttribute($this->person, 'email', $email); - - $this->assertSame($email, $this->person->getEmail()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::setEmail() - */ - public function setEmailReturnEmpty() - { - $email = $this->emailMock(); - - $result = $this->person->setEmail($email); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::getCellPhone() - */ - public function getCellPhoneReturnCellPhoneAttribute() - { - $cel = $this->phoneMock(); - - $this->modifyAttribute($this->person, 'cellPhone', $cel); - - $this->assertEquals($cel, $this->person->getCellPhone()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::setCellPhone() - */ - public function setCellPhoneReturnEmpty() - { - $cel = $this->phoneMock(); - - $result = $this->person->setCellPhone($cel); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::getFatherName() - */ - public function getFatherNameReturnFatherNameAttribute() - { - $fatherName = 'bar'; - - $this->modifyAttribute($this->person, 'fatherName', $fatherName); - - $this->assertEquals($fatherName, $this->person->getFatherName()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::setFatherName() - */ - public function setFatherNameReturnEmpty() - { - $result = $this->person->setFatherName('bar'); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::getMotherName() - */ - public function getMotherNameReturnMotherNameAttribute() - { - $motherName = 'bar'; - - $this->modifyAttribute($this->person, 'motherName', $motherName); - - $this->assertEquals($motherName, $this->person->getMotherName()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::setMotherName() - */ - public function setMotherNameReturnEmpty() - { - $result = $this->person->setMotherName('bar'); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::getPerson() - */ - public function getPersonReturnPersonAttribute() - { - $person = 'F'; - - $this->modifyAttribute($this->person, 'person', $person); - - $this->assertEquals($person, $this->person->getPerson()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::setPerson() - */ - public function setPersonReturnEmpty() - { - $result = $this->person->setPerson('F'); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::setPerson() - * @expectedException \InvalidArgumentException - */ - public function setPersonThrowsExceptionWhenEmpty() - { - $result = $this->person->setPerson(''); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::getSalaried() - */ - public function getSalariedMustBeReturnSalariedAttribute() - { - $this->modifyAttribute($this->person, 'salaried', true); - - $this->assertEquals(true, $this->person->getSalaried()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::setSalaried() - */ - public function setSalariedMustBeReturnNull() - { - $salaried = true; - - $result = $this->person->setSalaried($salaried); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::getBirth() - */ - public function getBirthMustBeReturnBirthAttribute() - { - $birth = new \DateTime(); - $this->modifyAttribute($this->person, 'birth', $birth); - - $this->assertEquals($birth, $this->person->getBirth()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::setBirth() - */ - public function setBirthMustBeReturnNull() - { - $birth = new \DateTime(); - - $result = $this->person->setBirth($birth); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::getAddress() - */ - public function getAddressMustBeReturnAddressAttribute() - { - $address = new Address(); - $this->modifyAttribute($this->person, 'address', $address); - - $this->assertEquals($address, $this->person->getAddress()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Person::setAddress() - */ - public function setAddressMustBeReturnNull() - { - $address = new Address(); - - $result = $this->person->setAddress($address); - - $this->assertNull($result); - } -} diff --git a/tests/Common/Base/PhoneTest.php b/tests/Common/Base/PhoneTest.php deleted file mode 100644 index 841aa4d..0000000 --- a/tests/Common/Base/PhoneTest.php +++ /dev/null @@ -1,138 +0,0 @@ - - */ -class PhoneTest extends TestCase -{ - use ChangeProtectedAttribute; - use Mock; - - /** - * @var Phone - */ - private $phone; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() - { - parent::setUp(); - - $this->phone = new Phone(); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() - { - $this->phone = null; - - parent::tearDown(); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Phone::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Phone::getNumber() - */ - public function getNumberReturnNumberAttribute() - { - $this->modifyAttribute($this->phone, 'number', 1); - - $this->assertEquals(1, $this->phone->getNumber()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Phone::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Phone::setNumber() - */ - public function setNumberReturnNull() - { - $number = '12341234'; - - $result = $this->phone->setNumber($number); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Phone::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Phone::setNumber() - * @expectedException \InvalidArgumentException - */ - public function setNumberThrowsExceptionWhenNumberIsToShort() - { - $number = '1234'; - - $result = $this->phone->setNumber($number); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Phone::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Phone::setNumber() - * @expectedException \InvalidArgumentException - */ - public function setNumberThrowsExceptionWhenNumberIsToLong() - { - $number = '12343434234432423432233432'; - - $result = $this->phone->setNumber($number); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Phone::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Phone::getType() - */ - public function getTypeReturnTypeAttribute() - { - $this->modifyAttribute($this->phone, 'type', 1); - - $this->assertEquals(1, $this->phone->getType()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Phone::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Phone::setType() - */ - public function setTypeReturnNull() - { - $type = Phone::CELLPHONE; - - $result = $this->phone->setType($type); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Phone::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Phone::setType() - * @expectedException \InvalidArgumentException - */ - public function setTypeThrowsExceptionWhenNotInPreDefinedConstants() - { - $result = $this->phone->setType(4); - - $this->assertNull($result); - } -} diff --git a/tests/Common/Base/PurchaserTest.php b/tests/Common/Base/PurchaserTest.php deleted file mode 100644 index dc768bf..0000000 --- a/tests/Common/Base/PurchaserTest.php +++ /dev/null @@ -1,114 +0,0 @@ - - */ -class PurchaserTest extends TestCase -{ - use ChangeProtectedAttribute; - - /** - * @var Purchaser - */ - private $purchaser; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() - { - parent::setUp(); - - $this->purchaser = new Purchaser(); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() - { - $this->purchaser = null; - - parent::tearDown(); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Purchaser::getPurchaserStateRegistration() - */ - public function getPurchaserStateRegistrationReturnPurchaserStateRegistrationAttribute() - { - $purchaser = 'foo'; - - $this->modifyAttribute($this->purchaser, 'purchaserStateRegistration', $purchaser); - - $this->assertEquals($purchaser, $this->purchaser->getPurchaserStateRegistration()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Purchaser::getPurchaserFantasyName() - */ - public function getPurchaserFantasyNameReturnPurchaserFantasyNameAttribute() - { - $purchaser = 'foo'; - - $this->modifyAttribute($this->purchaser, 'purchaserFantasyName', $purchaser); - - $this->assertEquals($purchaser, $this->purchaser->getPurchaserFantasyName()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Purchaser::getPurchaserSocialReason() - */ - public function getPurchaserSocialReasonReturnPurchaserSocialReasonAttribute() - { - $purchaser = 'foo'; - - $this->modifyAttribute($this->purchaser, 'purchaserSocialReason', $purchaser); - - $this->assertEquals($purchaser, $this->purchaser->getPurchaserSocialReason()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Purchaser::setPurchaserStateRegistration() - */ - public function setPurchaserStateRegistrationReturnEmpty() - { - $result = $this->purchaser->setPurchaserStateRegistration('Foo'); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Purchaser::setPurchaserFantasyName() - */ - public function setPurchaserFantasyNameReturnEmpty() - { - $result = $this->purchaser->setPurchaserFantasyName(1); - - $this->assertNull($result); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Purchaser::setPurchaserSocialReason() - */ - public function setPurchaserSocialReasonReturnEmpty() - { - $result = $this->purchaser->setPurchaserSocialReason(1); - - $this->assertNull($result); - } -} diff --git a/tests/Common/Base/SellerTest.php b/tests/Common/Base/SellerTest.php deleted file mode 100644 index 27787d7..0000000 --- a/tests/Common/Base/SellerTest.php +++ /dev/null @@ -1,74 +0,0 @@ - - */ -class SellerTest extends TestCase -{ - use ChangeProtectedAttribute; - - /** - * @var Seller - */ - private $seller; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() - { - parent::setUp(); - - $this->seller = new Seller(); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() - { - $this->seller = null; - - parent::tearDown(); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Seller::getCode() - */ - public function getCodeReturnCodeAttribute() - { - $this->modifyAttribute($this->seller, 'code', 1); - - $this->assertEquals($this->seller->getCode(), 1); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Seller::setCode() - */ - public function setCodeChangeCodeAttribute() - { - $this->seller->setCode(1); - - $this->assertEquals($this->seller->getCode(), 1); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Seller::setCode() - * @expectedException \InvalidArgumentException - */ - public function setCodeMustBeThrowsInvalidArgumentExceptionWhenEmpty() - { - $this->seller->setCode(''); - } -} diff --git a/tests/Common/Base/SequenceTest.php b/tests/Common/Base/SequenceTest.php deleted file mode 100644 index a59b45c..0000000 --- a/tests/Common/Base/SequenceTest.php +++ /dev/null @@ -1,78 +0,0 @@ - - */ -class SequenceTest extends TestCase -{ - use ChangeProtectedAttribute; - - /** - * @var Sequence - */ - private $sequence; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() - { - parent::setUp(); - - $this->sequence = new Sequence(); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() - { - $this->sequence = null; - - parent::tearDown(); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Sequence::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Sequence::getValue() - */ - public function getValueReturnValueAttribute() - { - $this->modifyAttribute($this->sequence, 'value', 1); - - $this->assertEquals(1, $this->sequence->getValue()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Sequence::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Sequence::setValue() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Sequence::getValue() - */ - public function setValueModifyValueAttribute() - { - $this->sequence->setValue(1); - - $this->assertEquals(1, $this->sequence->getValue()); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Sequence::__construct() - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Base\Sequence::setValue() - * @expectedException InvalidArgumentException - */ - public function setValueOnlyAcceptIntegerValue() - { - $this->sequence->setValue('foo'); - } -} diff --git a/tests/Common/Util/NumberTest.php b/tests/Common/Util/NumberTest.php deleted file mode 100644 index cd8b679..0000000 --- a/tests/Common/Util/NumberTest.php +++ /dev/null @@ -1,77 +0,0 @@ - - */ -class NumberTest extends TestCase -{ - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Util\Number::zeroFill - */ - public function zeroFillMustBeReturnExactLengthWithoutFillSideParam() - { - $foo = Number::zeroFill(1, 10); - - $this->assertEquals(10, strlen($foo)); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Util\Number::zeroFill - */ - public function zeroFillMustBeReturnExactStringWhenLengthIsEqualsWithoutFillSideParam() - { - $foo = Number::zeroFill(1, 3); - - $this->assertEquals(3, strlen($foo)); - } - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Util\Number::zeroFill - */ - public function zeroFillMustBeReturnExactLengthWithFillSideParam() - { - $foo = Number::zeroFill(1, 10, Number::FILL_LEFT); - - $this->assertEquals(10, strlen($foo)); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Util\Number::zeroFill - */ - public function zeroFillMustBeReturnExactStringWhenLengthIsEqualsWithFillSideParam() - { - $foo = Number::zeroFill(1, 3, Number::FILL_LEFT); - - $this->assertEquals(3, strlen($foo)); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Util\Number::zeroFill - * @expectedException \InvalidArgumentException - */ - public function zeroFillThrowsExceptionWhenValueLengthIsGreaterThanLength() - { - Number::zeroFill(11111, 2); - } - - /** - * @test - * @covers \MrPrompt\CaixaEconomicaFederal\Common\Util\Number::zeroFill - */ - public function zeroFillThrowsExceptionWithoutParams() - { - $return = Number::zeroFill('', ''); - - $this->assertEmpty($return); - } -} diff --git a/tests/Mock.php b/tests/Mock.php index 5d29b82..1839273 100644 --- a/tests/Mock.php +++ b/tests/Mock.php @@ -1,27 +1,27 @@ Date: Sun, 2 Dec 2018 01:23:57 -0200 Subject: [PATCH 2/2] chore(update-version): Fix ShipmentCommon version --- composer.json | 2 +- composer.lock | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 6030bec..2037309 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,7 @@ "require": { "php" : "^7.1", "andersondanilo/cnab_php" : "~1.3.10", - "mrprompt/shipmentcommon" : "dev-master" + "mrprompt/shipmentcommon" : "^2.0.3" }, "require-dev": { "phpunit/phpunit": "^6.1.3", diff --git a/composer.lock b/composer.lock index b2122d1..f305e9f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7f2c34001ad4f65ad2281e3e924c3476", + "content-hash": "52e17d68b038b1277676188c848a09d1", "packages": [ { "name": "andersondanilo/cnab_php", @@ -104,7 +104,7 @@ }, { "name": "mrprompt/shipmentcommon", - "version": "dev-master", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/mrprompt/ShipmentCommon.git", @@ -1830,7 +1830,6 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": { - "mrprompt/shipmentcommon": 20, "mockery/mockery": 20 }, "prefer-stable": false,