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

Fix for issue #3612 #3655

Merged
merged 1 commit into from Nov 5, 2016
Merged
Changes from all 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: 16 additions & 2 deletions src/Codeception/Module/Yii2.php
Expand Up @@ -166,15 +166,29 @@ public function _before(TestInterface $test)
$this->app = $this->client->getApplication();

// load fixtures before db transaction
if (method_exists($test, self::TEST_FIXTURES_METHOD)) {
$this->haveFixtures(call_user_func([$test, self::TEST_FIXTURES_METHOD]));
if ($test instanceof \Codeception\Test\Cest) {
$this->loadFixtures($test->getTestClass());
} else {
$this->loadFixtures($test);
}

if ($this->config['cleanup'] && $this->app->has('db')) {
$this->transaction = $this->app->db->beginTransaction();
}
}

/**
* load fixtures before db transaction
*
* @param mixed $test instance of test class
*/
private function loadFixtures($test)
{
if (method_exists($test, self::TEST_FIXTURES_METHOD)) {
$this->haveFixtures(call_user_func([$test, self::TEST_FIXTURES_METHOD]));
}
}

public function _after(\Codeception\TestInterface $test)
{
$_SESSION = [];
Expand Down