EmailActivationFixture::class, ]; } public function testConfirm() { $fixture = $this->tester->grabFixture('emailActivations', 'freshRegistrationConfirmation'); $model = $this->createModel($fixture['key']); $result = $model->confirm(); $this->assertInstanceOf(LoginResult::class, $result); $this->assertInstanceOf(AccountSession::class, $result->getSession(), 'session was generated'); $activationExists = EmailActivation::find()->andWhere(['key' => $fixture['key']])->exists(); $this->assertFalse($activationExists, 'email activation key is not exist'); /** @var Account $user */ $user = Account::findOne($fixture['account_id']); $this->assertEquals(Account::STATUS_ACTIVE, $user->status, 'user status changed to active'); } private function createModel($key) { return new ConfirmEmailForm([ 'key' => $key, ]); } }