示例#1
0
 public function _after(FunctionalTester $I)
 {
     $I->amOnPage(PostsPage::$url);
     $I->seeCurrentUrlEquals(PostsPage::$url);
     $I->seeAuthentication();
     $I->logout();
     $I->dontSeeAuthentication();
 }
示例#2
0
 public function loginUsingCredentials(FunctionalTester $I)
 {
     $I->dontSeeAuthentication();
     $I->haveRecord('users', $this->userAttributes);
     $I->amLoggedAs(['email' => '*****@*****.**', 'password' => 'password']);
     $I->amOnPage(PostsPage::$url);
     $I->seeCurrentUrlEquals(PostsPage::$url);
     $I->seeAuthentication();
     $I->logout();
     $I->dontSeeAuthentication();
 }
示例#3
0
 public function tryToCreateModifyAndDeleteContent(FunctionalTester $I)
 {
     $I->am('Anonymous user');
     $I->sendPOST('api/contents.json', $this->content3);
     $I->seeResponseCodeIs(401);
     $I->sendPUT('api/contents/' . $this->content2['key'] . '.json');
     $I->seeResponseCodeIs(401);
     $I->sendDELETE('api/contents/' . $this->content2['key'] . '.json');
     $I->seeResponseCodeIs(401);
     $I->am('ROLE_USER');
     $I->login($this->user['email']);
     $I->sendPOST('api/contents.json', $this->content3);
     $I->seeResponseCodeIs(403);
     $I->sendPUT('api/contents/' . $this->content2['key'] . '.json');
     $I->seeResponseCodeIs(403);
     $I->sendDELETE('api/contents/' . $this->content2['key'] . '.json');
     $I->seeResponseCodeIs(403);
     $I->am('ROLE_ADMIN');
     $I->login($this->admin['email']);
     $I->sendPOST('api/contents.json', $this->content3);
     $I->seeResponseCodeIs(200);
     $I->seeResponseContainsJson($this->content3);
     $id = $I->grabDataFromResponseByJsonPath('$.id')[0];
     $I->sendGET('api/contents/' . $this->content3['key'] . '.json');
     $I->seeResponseCodeIs(200);
     $I->seeResponseContainsJson($this->content3);
     $I->sendGET('api/contents/' . $id . '.json');
     $I->seeResponseCodeIs(200);
     $I->seeResponseContainsJson($this->content3);
     $this->content3['title'] = 'new title';
     $I->sendPUT('api/contents/' . $id . '.json', $this->content3);
     $I->seeResponseCodeIs(200);
     $I->seeResponseContainsJson($this->content3);
     $I->sendGET('api/contents/' . $id . '.json');
     $I->seeResponseCodeIs(200);
     $I->seeResponseContainsJson($this->content3);
     $I->sendDELETE('api/contents/' . $id . '.json');
     $I->seeResponseCodeIs(204);
     $I->sendGET('api/contents/' . $id . '.json');
     $I->seeResponseCodeIs(404);
     $I->logout();
     $I->sendGET('api/contents/' . $id . '.json');
     $I->seeResponseCodeIs(401);
 }
示例#4
0
<?php

$I = new FunctionalTester($scenario);
$I->wantTo('register a user from index page');
$I->expectTo('have a users in the database');
$I->amOnPage('/');
$I->haveRecord('users', ['email' => '*****@*****.**', 'username' => 'andelabendozy', 'password' => bcrypt('password'), 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'status' => TRUE, 'profile_state' => FALSE]);
$I->submitForm('form#register', ['name' => 'prosper', 'email' => '*****@*****.**', 'password' => '12345678', 'password_confirmation' => '12345678']);
$I->seeAuthentication();
$I->seeCurrentUrlEquals('');
$I->seeRecord('users', ['email' => '*****@*****.**']);
$I->seeAuthentication();
$I->wantTo('logout');
$I->logout();
$I->dontSeeAuthentication();
示例#5
0
文件: LinksCest.php 项目: mlanin/go
 public function _after(FunctionalTester $I)
 {
     $I->logout();
 }
示例#6
0
文件: AuthCest.php 项目: mlanin/go
 public function _after(FunctionalTester $I)
 {
     $I->logout();
     $I->dontSeeAuthentication();
 }