From 2773828611c7566b9f9157bf4a93cd4c1cc2c5cf Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Mon, 3 Feb 2014 15:28:01 -0500 Subject: [PATCH] fixed test break. --- docs/guide/test-fixture.md | 2 +- extensions/codeception/DbTestCase.php | 2 +- framework/test/FixtureTrait.php | 8 ++++---- tests/unit/framework/test/ActiveFixtureTest.php | 8 ++++---- tests/unit/framework/test/FixtureTest.php | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/guide/test-fixture.md b/docs/guide/test-fixture.md index 61ab543..23a8a7e 100644 --- a/docs/guide/test-fixture.md +++ b/docs/guide/test-fixture.md @@ -116,7 +116,7 @@ use app\tests\fixtures\UserProfileFixture; class UserProfileTest extends DbTestCase { - protected function fixtures() + public function fixtures() { return [ 'profiles' => UserProfileFixture::className(), diff --git a/extensions/codeception/DbTestCase.php b/extensions/codeception/DbTestCase.php index 6730c71..ef6a379 100644 --- a/extensions/codeception/DbTestCase.php +++ b/extensions/codeception/DbTestCase.php @@ -18,7 +18,7 @@ class DbTestCase extends TestCase /** * @inheritdoc */ - protected function globalFixtures() + public function globalFixtures() { return [ InitDbFixture::className(), diff --git a/framework/test/FixtureTrait.php b/framework/test/FixtureTrait.php index 59216d7..b733128 100644 --- a/framework/test/FixtureTrait.php +++ b/framework/test/FixtureTrait.php @@ -61,7 +61,7 @@ trait FixtureTrait * * @return array the fixtures needed by the current test case */ - protected function fixtures() + public function fixtures() { return []; } @@ -73,7 +73,7 @@ trait FixtureTrait * @return array the fixtures shared and required by different test cases. * @see fixtures() */ - protected function globalFixtures() + public function globalFixtures() { return []; } @@ -154,7 +154,7 @@ trait FixtureTrait /** * @return array the loaded fixtures for the current test case */ - protected function getFixtures() + public function getFixtures() { return $this->_fixtures; } @@ -164,7 +164,7 @@ trait FixtureTrait * @param string $name the fixture alias or class name * @return Fixture the fixture object, or null if the named fixture does not exist. */ - protected function getFixture($name) + public function getFixture($name) { $class = isset($this->_fixtureAliases[$name]) ? $this->_fixtureAliases[$name] : $name; return isset($this->_fixtures[$class]) ? $this->_fixtures[$class] : null; diff --git a/tests/unit/framework/test/ActiveFixtureTest.php b/tests/unit/framework/test/ActiveFixtureTest.php index d0169fd..7d049a2 100644 --- a/tests/unit/framework/test/ActiveFixtureTest.php +++ b/tests/unit/framework/test/ActiveFixtureTest.php @@ -33,14 +33,14 @@ class MyDbTestCase $this->unloadFixtures(); } - protected function fixtures() + public function fixtures() { return [ 'customers' => CustomerFixture::className(), ]; } - protected function globalFixtures() + public function globalFixtures() { return [ InitDbFixture::className(), @@ -71,7 +71,7 @@ class ActiveFixtureTest extends DatabaseTestCase { $test = new MyDbTestCase(); $test->setUp(); - $fixture = $test->customers; + $fixture = $test->getFixture('customers'); $this->assertEquals(CustomerFixture::className(), get_class($fixture)); $this->assertEquals(2, count($fixture)); $this->assertEquals(1, $fixture['customer1']['id']); @@ -84,7 +84,7 @@ class ActiveFixtureTest extends DatabaseTestCase { $test = new MyDbTestCase(); $test->setUp(); - $fixture = $test->customers; + $fixture = $test->getFixture('customers'); $this->assertEquals(Customer::className(), get_class($fixture->getModel('customer1'))); $this->assertEquals(1, $fixture->getModel('customer1')->id); $this->assertEquals('customer1@example.com', $fixture->getModel('customer1')->email); diff --git a/tests/unit/framework/test/FixtureTest.php b/tests/unit/framework/test/FixtureTest.php index c621a2f..8ce09ae 100644 --- a/tests/unit/framework/test/FixtureTest.php +++ b/tests/unit/framework/test/FixtureTest.php @@ -78,7 +78,7 @@ class MyTestCase return $this->getFixture($name); } - protected function fixtures() + public function fixtures() { switch ($this->scenario) { case 0: return [];