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
Changes from 4 commits
d0603c0
98d5394
2da04ee
4488f22
7f25727
1678c39
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,13 @@ | |
*/ | ||
abstract class CDbTestCase extends CTestCase | ||
{ | ||
|
||
/** | ||
* @var string valid fixtures path for the current test. Path must be | ||
* valid alias. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add @SInCE 1.1.14 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At the moment:
Better to be:
|
||
*/ | ||
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 | ||
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could be refactored to:
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. well, i thought that There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
} | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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))