Commit 27738286 by Qiang Xue

fixed test break.

parent 56f89dd4
......@@ -116,7 +116,7 @@ use app\tests\fixtures\UserProfileFixture;
class UserProfileTest extends DbTestCase
{
protected function fixtures()
public function fixtures()
{
return [
'profiles' => UserProfileFixture::className(),
......
......@@ -18,7 +18,7 @@ class DbTestCase extends TestCase
/**
* @inheritdoc
*/
protected function globalFixtures()
public function globalFixtures()
{
return [
InitDbFixture::className(),
......
......@@ -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;
......
......@@ -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);
......
......@@ -78,7 +78,7 @@ class MyTestCase
return $this->getFixture($name);
}
protected function fixtures()
public function fixtures()
{
switch ($this->scenario) {
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