2016-08-06 21:52:09 +05:30
|
|
|
<?php
|
|
|
|
namespace codeception\api\unit\models\profile;
|
|
|
|
|
|
|
|
use api\models\profile\AcceptRulesForm;
|
|
|
|
use common\models\Account;
|
2016-10-29 03:17:31 +05:30
|
|
|
use tests\codeception\api\unit\TestCase;
|
2016-08-06 21:52:09 +05:30
|
|
|
use tests\codeception\common\fixtures\AccountFixture;
|
|
|
|
use const common\LATEST_RULES_VERSION;
|
|
|
|
|
2016-10-29 03:17:31 +05:30
|
|
|
class AcceptRulesFormTest extends TestCase {
|
2016-08-06 21:52:09 +05:30
|
|
|
|
2016-10-29 03:17:31 +05:30
|
|
|
public function _fixtures() {
|
2016-08-06 21:52:09 +05:30
|
|
|
return [
|
|
|
|
'accounts' => AccountFixture::class,
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2016-10-29 03:17:31 +05:30
|
|
|
public function testAgreeWithLatestRules() {
|
|
|
|
/** @var Account $account */
|
|
|
|
$account = Account::findOne($this->tester->grabFixture('accounts', 'account-with-old-rules-version'));
|
|
|
|
$model = new AcceptRulesForm($account);
|
|
|
|
$this->assertTrue($model->agreeWithLatestRules());
|
|
|
|
$this->assertEquals(LATEST_RULES_VERSION, $account->rules_agreement_version);
|
2016-08-06 21:52:09 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
}
|