<?php
namespace frontend\tests\functional;
use common\fixtures\UserRequestFixtures;
use frontend\tests\FunctionalTester;
class ConfirmEmailCest
{
public function _fixtures()
{
return [
'userRequest' => [
'class' => UserRequestFixtures::class,
'dataFile' => codecept_data_dir() . 'user_request_data.php'
],
];
}
public function testConfirmEmail(FunctionalTester $I)
{
$I->amOnRoute('main/user/confirm-email',['token'=>'BADVYbYFO2HqHADmDXjoGHS4as9Y_Dtq']);
$I->see('Подтверждение', 'h1');
$I->see('Продолжить','form button');
$I->click('Продолжить');
$I->seeRecord('common\models\User', [
'email' => 'tester.email@example.com',
]);
}
}
1) ConfirmEmailCest: Test confirm email
Test tests\functional\ConfirmEmailCest.php:testConfirmEmail
[yii\base\ErrorException] Trying to get property of non-object
Scenario Steps:
4. $I->click("Продолжить") at tests\functional\ConfirmEmailCest.php:31
3. $I->see("Продолжить","form button") at tests\functional\ConfirmEmailCest.php:30
2. $I->see("Подтверждение","h1") at tests\functional\ConfirmEmailCest.php:29
1. $I->amOnRoute("main/user/confirm-email",{"token":"BADVYbYFO2HqHADmDXjoGHS4as9Y_Dtq"}) at tests\functional\ConfirmEmailCest.php:28
C:\OSPanel\domains\site.local\frontend\modules\cabinet\models\DocumentsSearch.php:225
[TransactionForcer] Transaction cancelled; all changes reverted.
[TransactionForcer] no longer watching new connections
[ConnectionWatcher] no longer watching new connections
[ConnectionWatcher] closing all (2) connections
[yii\db\Connection::open] 'Opening DB connection: mysql:host=localhost;dbname=test'
Destroying application
nfirmEmailCest: Test confirm email
gnature: frontend\tests\functional\ConfirmEmailCest:testConfirmEmail
st: tests\functional\ConfirmEmailCest.php:testConfirmEmail
enario --
Destroying application
Starting application
[ConnectionWatcher] watching new connections
[Fixtures] Loading fixtures
[ConnectionWatcher] watching new connections
[yii\db\Connection::open] 'Opening DB connection: mysql:host=localhost;dbname=test'
[ConnectionWatcher] Connection opened!
[ConnectionWatcher] Connection opened!
[ConnectionWatcher] no longer watching new connections
[ConnectionWatcher] closing all (1) connections
[Fixtures] Done
[TransactionForcer] watching new connections
am on route "main/user/confirm-email",{"token":"BADVYbYFO2HqHADmDXjoGHS4as9Y_Dtq"}
[Request Headers] []
[yii\db\Connection::open] 'Opening DB connection: mysql:host=localhost;dbname=test'
[ConnectionWatcher] Connection opened!
[TransactionForcer] Connection opened!
[TransactionForcer] Transaction started for: mysql:host=localhost;dbname=test
[yii\web\Session::open] 'Session started'
[Page] /index-test.php?r=main%2Fuser%2Fconfirm-email&token=BADVYbYFO2HqHADmDXjoGHS4as9Y_Dtq
[Response] 200
[Request Cookies] []
[Response Headers] {"content-type":["text/html; charset=UTF-8"]}
see "Подтверждение","h1"
see "Продолжить","form button"
click "Продолжить"
[Uri] http://localhost/index-test.php?r=main%2Fuser%2Fconfirm-email&token=BADVYbYFO2HqHADmDXjoGHS4as9Y_Dtq
[Method] POST
[Parameters] {"_csrf-frontend":"cw5_rV1Ujp8_PwGr3WNtq8-7F0-VMWKDMflEj_Z7l90mQybEN3n-0W1oZZyvOTvHvPAgYsJlJMlaoBDdr0r1sw=="}
[Request Headers] []
[yii\mail\BaseMailer::send] 'Sending email "Зрагеистрировался новый ползователь" to "user@ya.ru"'
[yii\mail\BaseMailer::send] 'Sending email "Вы успешно зарегистрировались на сайте" to "tester.email@example.com"'
[yii\web\User::login] 'User \'26\' logged in from with duration 0.'
[Redirect with headers]Array
(
[location] => Array
(
[0] => http://localhost/index-test.php?r=cabinet%2Fdefault%2Findex
)
[content-type] => Array
(
[0] => text/html; charset=UTF-8
)
)
[Page] http://localhost/index-test.php?r=main%2Fuser%2Fconfirm-email&token=BADVYbYFO2HqHADmDXjoGHS4as9Y_Dtq
[Response] 302
[Request Cookies] {"utms":"2f9c854af2d11befdcaab97edb9740fa46f410a99721dbbbcc97fa601f01be71a:2:{i:0;s:4:"utms";i:1;s:206:"a:1:{s:178:"a:6:{i:0;s
tp://localhost/index-test.php?r=main%2Fuser%2Fconfirm-email&token=BADVYbYFO2HqHADmDXjoGHS4as9Y_Dtq";}";i:1537418982;}";}","_csrf-frontend":"1143
0;s:14:"_csrf-frontend";i:1;s:32:"UMYij-pNRWd7rZVlsK7-WTFJkYTRY1bn";}"}
[Response Headers] {"location":["http://localhost/index-test.php?r=cabinet%2Fdefault%2Findex"],"content-type":["text/html; charset=UTF-8"]}
[Redirecting to] http://localhost/index-test.php?r=cabinet%2Fdefault%2Findex
RROR