From 147574fde9c8a794b456701cefba3fbdb2aef51c Mon Sep 17 00:00:00 2001 From: Koji Tanaka Date: Sun, 11 Jun 2017 21:50:41 +0900 Subject: [PATCH 1/3] add PHP 7.1 to .travis.yml --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index da52bb1..35c08b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ php: - 5.5 - 5.6 - 7.0 + - 7.1 env: global: From 2db946d2ec7885e04cadf84b276ef0b088cd1f5d Mon Sep 17 00:00:00 2001 From: Koji Tanaka Date: Sun, 18 Jun 2017 16:43:17 +0900 Subject: [PATCH 2/3] Test case class inherits PHPUnit 6 style superclass --- composer.json | 2 +- .../Case/Fabricate/Definition/FabricateDefinitionTest.php | 7 ++++--- tests/Case/Fabricate/FabricateContextTest.php | 7 ++++--- tests/Case/Fabricate/FabricateRegistryTest.php | 7 ++++--- tests/Case/Fabricate/FabricateSequenceTest.php | 7 ++++--- tests/Case/Fabricate/FabricateTest.php | 3 ++- tests/Case/Fabricate/Factory/FabricateFactoryTest.php | 5 +++-- 7 files changed, 22 insertions(+), 16 deletions(-) diff --git a/composer.json b/composer.json index d6a74e3..3f7d609 100755 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "fzaninotto/faker": "~1.4" }, "require-dev": { - "phpunit/phpunit": "*" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "suggest": { "sizuhiko/cake_fabricate": "for integration with CakePHP3" diff --git a/tests/Case/Fabricate/Definition/FabricateDefinitionTest.php b/tests/Case/Fabricate/Definition/FabricateDefinitionTest.php index 81af880..3aa3dac 100644 --- a/tests/Case/Fabricate/Definition/FabricateDefinitionTest.php +++ b/tests/Case/Fabricate/Definition/FabricateDefinitionTest.php @@ -1,12 +1,13 @@ -assertEquals(['name'=>'taro'], $data); @@ -25,4 +26,4 @@ public function testRunNullDefinition() { $target = new FabricateDefinition(null); $this->assertEquals([], $target->run(['name'=>'taro'], 'world')); } -} \ No newline at end of file +} diff --git a/tests/Case/Fabricate/FabricateContextTest.php b/tests/Case/Fabricate/FabricateContextTest.php index db98275..7f76777 100644 --- a/tests/Case/Fabricate/FabricateContextTest.php +++ b/tests/Case/Fabricate/FabricateContextTest.php @@ -1,13 +1,14 @@ -Config = new FabricateConfig(); @@ -53,4 +54,4 @@ public function testGetFakerInstance() { $this->Config->faker = \Faker\Factory::create(); $this->assertSame($this->Config->faker, $this->Context->faker()); } -} \ No newline at end of file +} diff --git a/tests/Case/Fabricate/FabricateRegistryTest.php b/tests/Case/Fabricate/FabricateRegistryTest.php index 92c69b4..0fb35ab 100644 --- a/tests/Case/Fabricate/FabricateRegistryTest.php +++ b/tests/Case/Fabricate/FabricateRegistryTest.php @@ -1,14 +1,15 @@ -Registry->clear(); $this->Registry->find('FabricateRegistryTestComment'); } -} \ No newline at end of file +} diff --git a/tests/Case/Fabricate/FabricateSequenceTest.php b/tests/Case/Fabricate/FabricateSequenceTest.php index b60004e..619e7fe 100644 --- a/tests/Case/Fabricate/FabricateSequenceTest.php +++ b/tests/Case/Fabricate/FabricateSequenceTest.php @@ -1,12 +1,13 @@ -Sequence = new FabricateSequence(1); @@ -20,4 +21,4 @@ public function testNext() { $this->assertEquals(2, $this->Sequence->next()); $this->assertEquals(2, $this->Sequence->current()); } -} \ No newline at end of file +} diff --git a/tests/Case/Fabricate/FabricateTest.php b/tests/Case/Fabricate/FabricateTest.php index 3c388db..0d002b1 100755 --- a/tests/Case/Fabricate/FabricateTest.php +++ b/tests/Case/Fabricate/FabricateTest.php @@ -4,11 +4,12 @@ use Fabricate\Fabricate; use Fabricate\Adaptor\FabricateArrayAdaptor; use Fabricate\Model\FabricateModel; +use PHPUnit\Framework\TestCase; /** * Fabricate class test case */ -class FabricateTest extends \PHPUnit_Framework_TestCase { +class FabricateTest extends TestCase { public function setUp() { parent::setUp(); Fabricate::clear(); diff --git a/tests/Case/Fabricate/Factory/FabricateFactoryTest.php b/tests/Case/Fabricate/Factory/FabricateFactoryTest.php index afa0342..6f530e5 100644 --- a/tests/Case/Fabricate/Factory/FabricateFactoryTest.php +++ b/tests/Case/Fabricate/Factory/FabricateFactoryTest.php @@ -4,11 +4,12 @@ use Fabricate\Factory\FabricateFactory; use Fabricate\Definition\FabricateDefinition; use Fabricate\Model\FabricateModel; +use PHPUnit\Framework\TestCase; /** * FabricateFactory class test case */ -class FabricateFactoryTest extends \PHPUnit_Framework_TestCase { +class FabricateFactoryTest extends TestCase { public function setUp() { $this->model = (new FabricateModel('Post')) ->addColumn('id', 'integer') @@ -34,4 +35,4 @@ public function testCreateDefinitionFactory() { public function testCreateThrowExceptionIfNotSupportInstance() { FabricateFactory::create('Not Supported'); } -} \ No newline at end of file +} From f331004167377bdcd7c2f4c376e853d1e8baba0a Mon Sep 17 00:00:00 2001 From: Koji Tanaka Date: Sun, 18 Jun 2017 16:57:04 +0900 Subject: [PATCH 3/3] Fix phpunit command --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 35c08b1..8e65657 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,9 +37,9 @@ before_script: - cp phpunit.xml.dist phpunit.xml script: - - sh -c "if [ '$DEFAULT' = '1' ]; then phpunit --stderr; fi" + - sh -c "if [ '$DEFAULT' = '1' ]; then vendor/bin/phpunit --stderr; fi" - sh -c "if [ '$PHPCS' = '1' ]; then vendor/bin/phpcs -p --extensions=php --standard=ruleset.xml ./src; fi" - - sh -c "if [ '$COVERALLS' = '1' ]; then phpunit --stderr --coverage-clover build/logs/clover.xml; fi" + - sh -c "if [ '$COVERALLS' = '1' ]; then vendor/bin/phpunit --stderr --coverage-clover build/logs/clover.xml; fi" after_script: - sh -c "if [ '$COVERALLS' = '1' ]; then php vendor/bin/coveralls -c .coveralls.yml -v; fi"