Permalink
Browse files

Codeception#3612

Now in Codeception Yii2 Module Documentation at http://codeception.com/docs/modules/Yii2 on Fixture section now placed code example:

<?php
// inside Cest file or Codeception\TestCase\Unit
public function _fixtures()
{
    return ['posts' => PostsFixture::className()]
}

For Cest file this does not works before this commit
  • Loading branch information...
primipilus authored and chris1312 committed Oct 30, 2016
1 parent 06f932a commit 55c84310628324a5b12e116ba3c23024800e7ae4
Showing with 16 additions and 2 deletions.
  1. +16 −2 src/Codeception/Module/Yii2.php
@@ -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 = [];

0 comments on commit 55c8431

Please sign in to comment.