From 6f1879dc80452bb386eeb2214ea0447a7d827db0 Mon Sep 17 00:00:00 2001 From: YAMANE Nana Date: Wed, 7 Aug 2019 16:02:19 +0900 Subject: [PATCH] support PHP 7.2 later (update tests, travis.yml) --- .gitignore | 2 ++ .php_cs | 12 ++++++++---- .travis.yml | 8 ++------ composer.json | 4 ++-- phpunit.xml.dist | 19 ++++++++++--------- tests/DateTime/AgeRangeTest.php | 8 +++++--- tests/DateTime/DateTest.php | 4 +++- tests/DateTime/DateTimeTest.php | 8 ++++++-- tests/DateTime/HourMinTest.php | 4 +++- tests/DateTime/MonthDayTest.php | 4 +++- tests/DateTime/PeriodTraitTest.php | 3 ++- tests/DateTime/ThreeMonthlyTraitTest.php | 3 ++- tests/DateTime/YearMonthTest.php | 4 +++- tests/DateTime/YearTest.php | 4 +++- tests/String/UniqueNameTest.php | 4 +++- tests/bootstrap.php | 3 +-- 16 files changed, 58 insertions(+), 36 deletions(-) diff --git a/.gitignore b/.gitignore index 51fc885..6122f12 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,5 @@ /php-cs-fixer.phar /vendor/ cache.properties +.php_cs.cache +.phpunit.result.cache diff --git a/.php_cs b/.php_cs index 1abc76f..854e2b3 100644 --- a/.php_cs +++ b/.php_cs @@ -1,10 +1,14 @@ in(__DIR__.'/src') ->in(__DIR__.'/tests') ; -return Symfony\CS\Config\Config::create() - ->fixers(array('-empty_return', '-blankline_after_open_tag', 'ordered_use', '-phpdoc_no_empty_return')) - ->finder($finder) +return PhpCsFixer\Config::create() + ->setRiskyAllowed(true) + ->setRules([ + 'blank_line_after_opening_tag' => true, + 'phpdoc_no_empty_return' => true, + ]) + ->setFinder($finder) ; diff --git a/.travis.yml b/.travis.yml index 343b543..7acc55b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,14 +7,10 @@ cache: - $HOME/.composer/cache php: - - 5.5 - - 5.6 - - 7 - - 7.1 + - 7.2 + - 7.3 matrix: - allow_failures: - - php: hhvm fast_finish: true before_script: diff --git a/composer.json b/composer.json index e990fd5..9b5873b 100644 --- a/composer.json +++ b/composer.json @@ -15,11 +15,11 @@ } ], "require": { - "php": ">=5.5", + "php": ">=7.2", "phpmentors/domain-kata": "~1.3" }, "require-dev": { - "phpunit/phpunit": "~4.6" + "phpunit/phpunit": "~8.3" }, "autoload": { "psr-4": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 0c37fb9..b170869 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,16 +1,17 @@ - + + - + tests - - - - - - - + + + src diff --git a/tests/DateTime/AgeRangeTest.php b/tests/DateTime/AgeRangeTest.php index 6567c96..590318f 100644 --- a/tests/DateTime/AgeRangeTest.php +++ b/tests/DateTime/AgeRangeTest.php @@ -12,10 +12,12 @@ namespace PHPMentors\DomainCommons\DateTime; +use PHPUnit\Framework\TestCase; + /** * @since Class available since Release 1.1.0 */ -class AgeRangeTest extends \PHPUnit_Framework_TestCase +class AgeRangeTest extends TestCase { /** * @param string $target @@ -47,7 +49,7 @@ public function getMaxAsDateData() */ public function getMaxAsDate(\DateTimeInterface $currentDate, $max, $maxAsDate) { - $clock = $this->getMock('PHPMentors\DomainCommons\DateTime\Clock'); + $clock = $this->createMock('PHPMentors\DomainCommons\DateTime\Clock'); $clock->method('now')->will($this->returnValue($currentDate)); $ageRange = new AgeRange(); $ageRange->setClock($clock); @@ -76,7 +78,7 @@ public function getMinAsDateData() */ public function getMinAsDate(\DateTimeInterface $currentDate, $min, $minAsDate) { - $clock = $this->getMock('PHPMentors\DomainCommons\DateTime\Clock'); + $clock = $this->createMock('PHPMentors\DomainCommons\DateTime\Clock'); $clock->method('now')->will($this->returnValue($currentDate)); $ageRange = new AgeRange(); $ageRange->setClock($clock); diff --git a/tests/DateTime/DateTest.php b/tests/DateTime/DateTest.php index 62748d9..4f26176 100644 --- a/tests/DateTime/DateTest.php +++ b/tests/DateTime/DateTest.php @@ -12,7 +12,9 @@ namespace PHPMentors\DomainCommons\DateTime; -class DateTest extends \PHPUnit_Framework_TestCase +use PHPUnit\Framework\TestCase; + +class DateTest extends TestCase { /** * @test diff --git a/tests/DateTime/DateTimeTest.php b/tests/DateTime/DateTimeTest.php index df1c599..3f58541 100644 --- a/tests/DateTime/DateTimeTest.php +++ b/tests/DateTime/DateTimeTest.php @@ -12,7 +12,10 @@ namespace PHPMentors\DomainCommons\DateTime; -class DateTimeTest extends \PHPUnit_Framework_TestCase +use PHPMentors\DomainCommons\DateTime\Exception\UnsupportedCalculation; +use PHPUnit\Framework\TestCase; + +class DateTimeTest extends TestCase { /** * @test @@ -69,10 +72,11 @@ public function addMonthsData() * @param string $dateStr * @param int $months * @dataProvider addMonthsThrowsExceptionData - * @expectedException \PHPMentors\DomainCommons\DateTime\Exception\UnsupportedCalculation */ public function addMonthsThrowsException($dateStr, $months) { + $this->expectException(UnsupportedCalculation::class); + $date = new DateTime($dateStr); $date->addMonths($months); diff --git a/tests/DateTime/HourMinTest.php b/tests/DateTime/HourMinTest.php index 4ac0b11..33ed5d4 100644 --- a/tests/DateTime/HourMinTest.php +++ b/tests/DateTime/HourMinTest.php @@ -12,7 +12,9 @@ namespace PHPMentors\DomainCommons\DateTime; -class HourMinTest extends \PHPUnit_Framework_TestCase +use PHPUnit\Framework\TestCase; + +class HourMinTest extends TestCase { /** * @test diff --git a/tests/DateTime/MonthDayTest.php b/tests/DateTime/MonthDayTest.php index eb8d039..d078f76 100644 --- a/tests/DateTime/MonthDayTest.php +++ b/tests/DateTime/MonthDayTest.php @@ -12,7 +12,9 @@ namespace PHPMentors\DomainCommons\DateTime; -class MonthDayTest extends \PHPUnit_Framework_TestCase +use PHPUnit\Framework\TestCase; + +class MonthDayTest extends TestCase { /** * @test diff --git a/tests/DateTime/PeriodTraitTest.php b/tests/DateTime/PeriodTraitTest.php index b8650a3..2d91460 100644 --- a/tests/DateTime/PeriodTraitTest.php +++ b/tests/DateTime/PeriodTraitTest.php @@ -12,6 +12,7 @@ namespace PHPMentors\DomainCommons\DateTime; +use PHPUnit\Framework\TestCase; use PHPMentors\DomainCommons\DateTime\Period\DailyIteratableInterface; use PHPMentors\DomainCommons\DateTime\Period\DailyTrait; @@ -26,7 +27,7 @@ public function __construct($start, $end) } } -class PeriodTraitTest extends \PHPUnit_Framework_TestCase +class PeriodTraitTest extends TestCase { /** * @test diff --git a/tests/DateTime/ThreeMonthlyTraitTest.php b/tests/DateTime/ThreeMonthlyTraitTest.php index 32e8b78..5b21c04 100644 --- a/tests/DateTime/ThreeMonthlyTraitTest.php +++ b/tests/DateTime/ThreeMonthlyTraitTest.php @@ -12,6 +12,7 @@ namespace PHPMentors\DomainCommons\DateTime; +use PHPUnit\Framework\TestCase; use PHPMentors\DomainCommons\DateTime\Period\MonthlyIteratableInterface; use PHPMentors\DomainCommons\DateTime\Period\ThreeMonthlyTrait; @@ -38,7 +39,7 @@ public function getStart(){return $this->start;} public function getEnd(){return $this->end;} } -class ThreeMonthlyTraitTest extends \PHPUnit_Framework_TestCase +class ThreeMonthlyTraitTest extends TestCase { /** * @test diff --git a/tests/DateTime/YearMonthTest.php b/tests/DateTime/YearMonthTest.php index 9affbce..65b3dfb 100644 --- a/tests/DateTime/YearMonthTest.php +++ b/tests/DateTime/YearMonthTest.php @@ -12,7 +12,9 @@ namespace PHPMentors\DomainCommons\DateTime; -class YearMonthTest extends \PHPUnit_Framework_TestCase +use PHPUnit\Framework\TestCase; + +class YearMonthTest extends TestCase { /** * @test diff --git a/tests/DateTime/YearTest.php b/tests/DateTime/YearTest.php index 0b363bf..1cf30b5 100644 --- a/tests/DateTime/YearTest.php +++ b/tests/DateTime/YearTest.php @@ -12,7 +12,9 @@ namespace PHPMentors\DomainCommons\DateTime; -class YearTest extends \PHPUnit_Framework_TestCase +use PHPUnit\Framework\TestCase; + +class YearTest extends TestCase { /** * @test diff --git a/tests/String/UniqueNameTest.php b/tests/String/UniqueNameTest.php index 1666337..3b5c866 100644 --- a/tests/String/UniqueNameTest.php +++ b/tests/String/UniqueNameTest.php @@ -12,10 +12,12 @@ namespace PHPMentors\DomainCommons\String; +use PHPUnit\Framework\TestCase; + /** * @since Class available since Release 1.1.1 */ -class UniqueNameTest extends \PHPUnit_Framework_TestCase +class UniqueNameTest extends TestCase { public function test() { diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 896a826..3a9f8b8 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,4 +1,3 @@