2016-01-02 19:13:18 +05:30
|
|
|
<?php
|
|
|
|
namespace tests\codeception\common\_support;
|
|
|
|
|
|
|
|
use Codeception\Module;
|
2016-01-15 14:51:27 +05:30
|
|
|
use tests\codeception\common\fixtures\AccountFixture;
|
2016-01-21 02:44:29 +05:30
|
|
|
use tests\codeception\common\fixtures\EmailActivationFixture;
|
2016-02-14 23:20:10 +05:30
|
|
|
use tests\codeception\common\fixtures\OauthClientFixture;
|
|
|
|
use tests\codeception\common\fixtures\OauthScopeFixture;
|
|
|
|
use tests\codeception\common\fixtures\OauthSessionFixture;
|
2016-01-02 19:13:18 +05:30
|
|
|
use yii\test\FixtureTrait;
|
|
|
|
use yii\test\InitDbFixture;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This helper is used to populate the database with needed fixtures before any tests are run.
|
2016-01-15 14:51:27 +05:30
|
|
|
* All fixtures will be loaded before the suite is started and unloaded after it completes.
|
2016-01-02 19:13:18 +05:30
|
|
|
*/
|
2016-01-15 14:51:27 +05:30
|
|
|
class FixtureHelper extends Module {
|
2016-01-02 19:13:18 +05:30
|
|
|
|
|
|
|
/**
|
|
|
|
* Redeclare visibility because codeception includes all public methods that do not start with "_"
|
|
|
|
* and are not excluded by module settings, in actor class.
|
|
|
|
*/
|
|
|
|
use FixtureTrait {
|
|
|
|
loadFixtures as protected;
|
|
|
|
fixtures as protected;
|
|
|
|
globalFixtures as protected;
|
|
|
|
unloadFixtures as protected;
|
|
|
|
getFixtures as protected;
|
|
|
|
getFixture as protected;
|
|
|
|
}
|
|
|
|
|
2016-01-15 14:51:27 +05:30
|
|
|
public function _beforeSuite($settings = []) {
|
2016-01-02 19:13:18 +05:30
|
|
|
$this->loadFixtures();
|
|
|
|
}
|
|
|
|
|
2016-01-15 14:51:27 +05:30
|
|
|
public function _afterSuite() {
|
2016-01-02 19:13:18 +05:30
|
|
|
$this->unloadFixtures();
|
|
|
|
}
|
|
|
|
|
2016-01-15 14:51:27 +05:30
|
|
|
public function globalFixtures() {
|
2016-01-02 19:13:18 +05:30
|
|
|
return [
|
|
|
|
InitDbFixture::className(),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2016-01-15 14:51:27 +05:30
|
|
|
public function fixtures() {
|
2016-01-02 19:13:18 +05:30
|
|
|
return [
|
2016-01-15 14:51:27 +05:30
|
|
|
'accounts' => [
|
|
|
|
'class' => AccountFixture::class,
|
|
|
|
'dataFile' => '@tests/codeception/common/fixtures/data/accounts.php',
|
|
|
|
],
|
2016-01-21 02:44:29 +05:30
|
|
|
'emailActivations' => [
|
|
|
|
'class' => EmailActivationFixture::class,
|
|
|
|
'dataFile' => '@tests/codeception/common/fixtures/data/email-activations.php',
|
|
|
|
],
|
2016-02-14 23:20:10 +05:30
|
|
|
'oauthClients' => [
|
|
|
|
'class' => OauthClientFixture::class,
|
|
|
|
'dataFile' => '@tests/codeception/common/fixtures/data/oauth-clients.php',
|
|
|
|
],
|
|
|
|
'oauthScopes' => [
|
|
|
|
'class' => OauthScopeFixture::class,
|
|
|
|
'dataFile' => '@tests/codeception/common/fixtures/data/oauth-scopes.php',
|
|
|
|
],
|
|
|
|
'oauthSessions' => [
|
|
|
|
'class' => OauthSessionFixture::class,
|
|
|
|
'dataFile' => '@tests/codeception/common/fixtures/data/oauth-sessions.php',
|
|
|
|
],
|
2016-01-02 19:13:18 +05:30
|
|
|
];
|
|
|
|
}
|
2016-02-14 23:20:10 +05:30
|
|
|
|
2016-01-02 19:13:18 +05:30
|
|
|
}
|