From 1d2acabd12b96781aa2d9e755bb4c0068366e558 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20HOUZ=C3=89?= Date: Tue, 15 Dec 2015 10:02:20 +0100 Subject: [PATCH 1/3] Rename validateValue into validate to comply with the new validatorInterface. --- tests/unit/Constraints/VatValidator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/Constraints/VatValidator.php b/tests/unit/Constraints/VatValidator.php index cf608ba..eb6f6dd 100644 --- a/tests/unit/Constraints/VatValidator.php +++ b/tests/unit/Constraints/VatValidator.php @@ -24,7 +24,7 @@ public function testValidNumber($number) { $this ->if($validator = Validation::createValidator()) - ->object(($validator->validateValue($number, new Vat))) + ->object(($validator->validate($number, new Vat))) ->isInstanceOf('Symfony\Component\Validator\ConstraintViolationList') ->hasSize(0) ; @@ -34,7 +34,7 @@ public function testInvalidNumber($number) { $this ->if($validator = Validation::createValidator()) - ->object(($validator->validateValue($number, new Vat))) + ->object(($validator->validate($number, new Vat))) ->isInstanceOf('Symfony\Component\Validator\ConstraintViolationList') ->hasSize(1) ; From a93593335aae9d516c13137bf45520d42a37633d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20HOUZ=C3=89?= Date: Tue, 15 Dec 2015 10:03:16 +0100 Subject: [PATCH 2/3] Adopt atoum 2.0. --- composer.json | 2 +- tests/unit/Operation/Amount/Percentage.php | 8 ++++---- tests/unit/Operation/Amount/Price.php | 14 +++++++------- tests/unit/Vat/VatNumber.php | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/composer.json b/composer.json index e87c7f6..57d5ced 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "php-soap": "Mandatory for usage of ViesValidator" }, "require-dev": { - "atoum/atoum": "*@dev" + "atoum/atoum": "~1.0|~2.0" }, "autoload": { "psr-0": { diff --git a/tests/unit/Operation/Amount/Percentage.php b/tests/unit/Operation/Amount/Percentage.php index 26eedba..f4591de 100644 --- a/tests/unit/Operation/Amount/Percentage.php +++ b/tests/unit/Operation/Amount/Percentage.php @@ -27,7 +27,7 @@ public function testConstruct($value, $expectedValue) { $this ->if($percentage = new TestedPercentage($value)) - ->float($percentage->getValue()) + ->phpFloat($percentage->getValue()) ->isIdenticalTo($expectedValue) ->if($level = $percentage->getLevel()) ->integer($level) @@ -39,7 +39,7 @@ public function testToString($value, $expectedValue) { $this ->if($percentage = new TestedPercentage($value)) - ->string((string) $percentage) + ->phpString((string) $percentage) ->isIdenticalTo($expectedValue) ; } @@ -50,9 +50,9 @@ public function testComputeWithPercentage($operation, $left, $right, $expectedRe ->if($percentage = new TestedPercentage($left)) ->object($result = $percentage->compute($operation, new TestedPercentage($right))) ->isInstanceOf('\Rezzza\Accounting\Operation\Amount\Result') - ->float($result->getValue()->getValue()) + ->phpFloat($result->getValue()->getValue()) ->isEqualTo($expectedResult) - ->float($result->getComplement()->getValue()) + ->phpFloat($result->getComplement()->getValue()) ->isEqualTo($expectedResultComplement) ; } diff --git a/tests/unit/Operation/Amount/Price.php b/tests/unit/Operation/Amount/Price.php index 5eddcb5..069dec0 100644 --- a/tests/unit/Operation/Amount/Price.php +++ b/tests/unit/Operation/Amount/Price.php @@ -27,9 +27,9 @@ public function testConstruct($value, $currencyCode, $expectedValue, $expectedCu { $this ->if($price = new TestedPrice($value, $currencyCode)) - ->float($price->getValue()) + ->phpFloat($price->getValue()) ->isIdenticalTo($expectedValue) - ->string($price->getCurrency()) + ->phpString($price->getCurrency()) ->isIdenticalTo($expectedCurrencyCode) ; } @@ -41,7 +41,7 @@ public function testToString($value, $currencyCode, $expectedOutput) } $this ->if($price = new TestedPrice($value, $currencyCode)) - ->string((string) $price) + ->phpString((string) $price) ->isIdenticalTo($expectedOutput) ; } @@ -90,9 +90,9 @@ public function testComputeWithPrice($operation, $left, $right, $expectedResult, ->if($price = new TestedPrice($left)) ->object($result = $price->compute($operation, new TestedPrice($right))) ->isInstanceOf('\Rezzza\Accounting\Operation\Amount\Result') - ->float($result->getValue()->getValue()) + ->phpFloat($result->getValue()->getValue()) ->isEqualTo($expectedResult) - ->float($result->getComplement()->getValue()) + ->phpFloat($result->getComplement()->getValue()) ->isEqualTo($expectedResultComplement) ; } @@ -117,9 +117,9 @@ public function testComputeWithPercent($operation, $left, $right, $expectedResul ->if($price = new TestedPrice($left)) ->object($result = $price->compute($operation, new \mock\Rezzza\Accounting\Operation\Amount\Percentage($right))) ->isInstanceOf('\Rezzza\Accounting\Operation\Amount\Result') - ->float($result->getValue()->getValue()) + ->phpFloat($result->getValue()->getValue()) ->isEqualTo($expectedResult) - ->float($result->getComplement()->getValue()) + ->phpFloat($result->getComplement()->getValue()) ->isEqualTo($expectedResultComplement) ; } diff --git a/tests/unit/Vat/VatNumber.php b/tests/unit/Vat/VatNumber.php index d165cf9..2d7aaf6 100644 --- a/tests/unit/Vat/VatNumber.php +++ b/tests/unit/Vat/VatNumber.php @@ -22,7 +22,7 @@ public function testConstruct($countryCode, $number, $expectedOutput) { $this ->if($vatNumber = new TestedVatNumber($countryCode, $number)) - ->string((string) $vatNumber) + ->phpString((string) $vatNumber) ->isIdenticalTo($expectedOutput) ; } @@ -31,7 +31,7 @@ public function testFromString($input, $expectedOutput) { $this ->if($vatNumber = new TestedVatNumber) - ->string((string) $vatNumber->fromString($input)) + ->phpString((string) $vatNumber->fromString($input)) ->isIdenticalTo($expectedOutput) ; } @@ -41,7 +41,7 @@ public function testValidCountryCode($countryCode, $expectedCountryCode) $this ->if($vatNumber = new TestedVatNumber) ->and($vatNumber->setCountryCode($countryCode)) - ->string($vatNumber->getCountryCode()) + ->phpString($vatNumber->getCountryCode()) ->isIdenticalTo($expectedCountryCode) ; } @@ -78,7 +78,7 @@ public function testValidNumber($number, $expectedNumber) $this ->if($vatNumber = new TestedVatNumber) ->and($vatNumber->setNumber($number)) - ->string($vatNumber->getNumber()) + ->phpString($vatNumber->getNumber()) ->isIdenticalTo($expectedNumber) ; } From f02c60e2aa26134133f95c93e4fb900c87465084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20HOUZ=C3=89?= Date: Tue, 15 Dec 2015 10:03:47 +0100 Subject: [PATCH 3/3] Modernize travis.yml & add php 7 to build matrix. --- .travis.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a5fe833..1712e84 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,21 @@ language: php +dist: trusty +sudo: false + php: - 5.3 - 5.4 - 5.5 - 5.6 + - 7.0 before_script: - mkdir -p web/code-coverage - - composer install --dev --prefer-source + - composer install --dev --prefer-source --optimize-autoloader script: - - bin/atoum + - bin/atoum -ulr notifications: email: