Commit 27738286 by Qiang Xue

fixed test break.

parent 56f89dd4
...@@ -116,7 +116,7 @@ use app\tests\fixtures\UserProfileFixture; ...@@ -116,7 +116,7 @@ use app\tests\fixtures\UserProfileFixture;
class UserProfileTest extends DbTestCase class UserProfileTest extends DbTestCase
{ {
protected function fixtures() public function fixtures()
{ {
return [ return [
'profiles' => UserProfileFixture::className(), 'profiles' => UserProfileFixture::className(),
......
...@@ -18,7 +18,7 @@ class DbTestCase extends TestCase ...@@ -18,7 +18,7 @@ class DbTestCase extends TestCase
/** /**
* @inheritdoc * @inheritdoc
*/ */
protected function globalFixtures() public function globalFixtures()
{ {
return [ return [
InitDbFixture::className(), InitDbFixture::className(),
......
...@@ -61,7 +61,7 @@ trait FixtureTrait ...@@ -61,7 +61,7 @@ trait FixtureTrait
* *
* @return array the fixtures needed by the current test case * @return array the fixtures needed by the current test case
*/ */
protected function fixtures() public function fixtures()
{ {
return []; return [];
} }
...@@ -73,7 +73,7 @@ trait FixtureTrait ...@@ -73,7 +73,7 @@ trait FixtureTrait
* @return array the fixtures shared and required by different test cases. * @return array the fixtures shared and required by different test cases.
* @see fixtures() * @see fixtures()
*/ */
protected function globalFixtures() public function globalFixtures()
{ {
return []; return [];
} }
...@@ -154,7 +154,7 @@ trait FixtureTrait ...@@ -154,7 +154,7 @@ trait FixtureTrait
/** /**
* @return array the loaded fixtures for the current test case * @return array the loaded fixtures for the current test case
*/ */
protected function getFixtures() public function getFixtures()
{ {
return $this->_fixtures; return $this->_fixtures;
} }
...@@ -164,7 +164,7 @@ trait FixtureTrait ...@@ -164,7 +164,7 @@ trait FixtureTrait
* @param string $name the fixture alias or class name * @param string $name the fixture alias or class name
* @return Fixture the fixture object, or null if the named fixture does not exist. * @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; $class = isset($this->_fixtureAliases[$name]) ? $this->_fixtureAliases[$name] : $name;
return isset($this->_fixtures[$class]) ? $this->_fixtures[$class] : null; return isset($this->_fixtures[$class]) ? $this->_fixtures[$class] : null;
......
...@@ -33,14 +33,14 @@ class MyDbTestCase ...@@ -33,14 +33,14 @@ class MyDbTestCase
$this->unloadFixtures(); $this->unloadFixtures();
} }
protected function fixtures() public function fixtures()
{ {
return [ return [
'customers' => CustomerFixture::className(), 'customers' => CustomerFixture::className(),
]; ];
} }
protected function globalFixtures() public function globalFixtures()
{ {
return [ return [
InitDbFixture::className(), InitDbFixture::className(),
...@@ -71,7 +71,7 @@ class ActiveFixtureTest extends DatabaseTestCase ...@@ -71,7 +71,7 @@ class ActiveFixtureTest extends DatabaseTestCase
{ {
$test = new MyDbTestCase(); $test = new MyDbTestCase();
$test->setUp(); $test->setUp();
$fixture = $test->customers; $fixture = $test->getFixture('customers');
$this->assertEquals(CustomerFixture::className(), get_class($fixture)); $this->assertEquals(CustomerFixture::className(), get_class($fixture));
$this->assertEquals(2, count($fixture)); $this->assertEquals(2, count($fixture));
$this->assertEquals(1, $fixture['customer1']['id']); $this->assertEquals(1, $fixture['customer1']['id']);
...@@ -84,7 +84,7 @@ class ActiveFixtureTest extends DatabaseTestCase ...@@ -84,7 +84,7 @@ class ActiveFixtureTest extends DatabaseTestCase
{ {
$test = new MyDbTestCase(); $test = new MyDbTestCase();
$test->setUp(); $test->setUp();
$fixture = $test->customers; $fixture = $test->getFixture('customers');
$this->assertEquals(Customer::className(), get_class($fixture->getModel('customer1'))); $this->assertEquals(Customer::className(), get_class($fixture->getModel('customer1')));
$this->assertEquals(1, $fixture->getModel('customer1')->id); $this->assertEquals(1, $fixture->getModel('customer1')->id);
$this->assertEquals('customer1@example.com', $fixture->getModel('customer1')->email); $this->assertEquals('customer1@example.com', $fixture->getModel('customer1')->email);
......
...@@ -78,7 +78,7 @@ class MyTestCase ...@@ -78,7 +78,7 @@ class MyTestCase
return $this->getFixture($name); return $this->getFixture($name);
} }
protected function fixtures() public function fixtures()
{ {
switch ($this->scenario) { switch ($this->scenario) {
case 0: return []; case 0: return [];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment