<?php

$I = new SeleniumTester($scenario);
$I->am('a guest');
$I->wantTo('make sure no one could log out if not having correct cookie');
$I->setCookie('password', 'anotherwrongcookie');
$I->amOnPage('/password');
$I->sendPOST('http://manhgiay.dev/password/logOut');
$I->seeCurrentUrlEquals('/password/login');
$I->resetCookie('password');
$I->sendPOST('http://manhgiay.dev/password/logOut');
$I->seeCurrentUrlEquals('/password/login');
<?php

$I = new SeleniumTester($scenario);
$I->am('a guest');
$I->wantTo('ensure no way to update content without a correct cookie');
$I->amOnPage('/password');
$I->seeCurrentUrlEquals('/password/login');
$I->sendPOST('http://manhgiay.dev/password/updateContent', ['content' => 'This will not made it to database']);
$I->seeInDatabase('manhgiays', ['content' => ""]);
<?php

$I = new SeleniumTester($scenario);
$I->am('a guest');
$I->wantTo('Ensure cannot change password if cookie not correct');
$I->setCookie('password', 'thewrongpassword');
$I->amOnPage('/password');
$I->sendPOST('http://manhgiay.dev/password/updatePassword', ['password' => 'password']);
$I->seeCurrentUrlEquals('/password/login');
<?php

$I = new SeleniumTester($scenario);
$I->am('a guest');
$I->wantTo('guarantee no one can remove password if not having correct cookie');
$I->amOnPage('/password');
$I->setCookie('password', 'yetAnotherWrongCookie');
$I->sendPOST('http://manhgiay.dev/password/removePassword');
$I->seeCurrentUrlEquals('/password/login');
$I->resetCookie('password');
$I->sendPOST('http://manhgiay.dev/password/removePassword');
$I->seeCurrentUrlEquals('/password/login');