mirror of
https://github.com/elyby/accounts.git
synced 2024-12-25 22:59:53 +05:30
50439fdaeb
У EmailActivation добавлено поле $_data и дописано поведение для работы с ним Упрощено подключение фикстур для EmailActivations
70 lines
2.2 KiB
PHP
70 lines
2.2 KiB
PHP
<?php
|
|
namespace tests\codeception\common\_support;
|
|
|
|
use Codeception\Module;
|
|
use Codeception\TestCase;
|
|
use tests\codeception\common\fixtures\AccountFixture;
|
|
use tests\codeception\common\fixtures\EmailActivationFixture;
|
|
use tests\codeception\common\fixtures\OauthClientFixture;
|
|
use tests\codeception\common\fixtures\OauthScopeFixture;
|
|
use tests\codeception\common\fixtures\OauthSessionFixture;
|
|
use yii\test\FixtureTrait;
|
|
use yii\test\InitDbFixture;
|
|
|
|
/**
|
|
* This helper is used to populate the database with needed fixtures before any tests are run.
|
|
* All fixtures will be loaded before the suite is started and unloaded after it completes.
|
|
*/
|
|
class FixtureHelper extends Module {
|
|
|
|
/**
|
|
* 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;
|
|
}
|
|
|
|
public function _before(TestCase $test) {
|
|
$this->loadFixtures();
|
|
}
|
|
|
|
public function _after(TestCase $test) {
|
|
$this->unloadFixtures();
|
|
}
|
|
|
|
public function globalFixtures() {
|
|
return [
|
|
InitDbFixture::className(),
|
|
];
|
|
}
|
|
|
|
public function fixtures() {
|
|
return [
|
|
'accounts' => [
|
|
'class' => AccountFixture::class,
|
|
'dataFile' => '@tests/codeception/common/fixtures/data/accounts.php',
|
|
],
|
|
'emailActivations' => EmailActivationFixture::class,
|
|
'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',
|
|
],
|
|
];
|
|
}
|
|
|
|
}
|