Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new property CDbTestCase.fixturesPath #2257

Closed
wants to merge 6 commits into from
Closed
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions framework/test/CDbTestCase.php
Expand Up @@ -39,6 +39,13 @@
*/
abstract class CDbTestCase extends CTestCase
{

/**
* @var string valid fixtures path for the current test. Path must be
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why new line? Explanation can be placed at the single line.
In this way it would be easier to read.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new line where? well, it is really strange to here that some extra spaces are not good for easy read and here new line is good for that))

* valid alias.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add @SInCE 1.1.14

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment:

/**
 * @var string valid fixtures path for the current test. Path must be
 * valid alias.
*/

Better to be:

/**
 * @var string valid fixtures path for the current test. Path must be  valid alias.
 */

*/
public $fixturePath;

/**
* @var array a list of fixtures that should be loaded before each test method executes.
* The array keys are fixture names, and the array values are either AR class names
Expand Down Expand Up @@ -113,6 +120,17 @@ public function getFixtureRecord($name,$alias)
protected function setUp()
{
parent::setUp();

if ($this->fixturePath !== null)
{
if (Yii::getPathOfAlias($this->fixturePath))
$this->getFixtureManager()->basePath = Yii::getPathOfAlias($this->fixturePath);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be refactored to:

if ($basePath=Yii::getPathOfAlias($this->fixturePath))
        $this->getFixtureManager()->basePath=$basePath;

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not easy to read, but anyway as you command.

else
throw new CException(Yii::t('yii','{path}" is not a valid directory.',array(
'{path}' => $this->fixturePath
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ragazzo, please maintain the code style: there are a lot of extra spaces in your code.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, i thought that extra-spaces are just to easy code read. no?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and it will be used in Yii2. For now please refer to https://github.com/yiisoft/yii/wiki/Core-framework-code-style

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still extra spaces around '=>'.

)));
}

if(is_array($this->fixtures))
$this->getFixtureManager()->load($this->fixtures);
}
Expand Down