Пример #1
0
 public function checkAuthEndpoint(FunctionalTester $I)
 {
     $I->wantTo('Visit login endpoint');
     $I->amOnPage('login');
     $I->seeResponseCodeIs(200);
     $I->wantTo('Visit register endpoint');
     $I->amOnPage('register');
     $I->seeResponseCodeIs(200);
 }
Пример #2
0
 /**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function updateIssue(FunctionalTester $I)
 {
     $I->am('Admin User');
     $I->wantTo('edit an existing project issue details');
     $admin = $I->createUser(1, 4);
     $developer1 = $I->createUser(2, 2);
     // developer
     $I->amLoggedAs($admin);
     $project = $I->createProject(1, [$developer1]);
     $I->amOnAction('Project\\IssueController@getNew', ['project' => $project]);
     $issue = $I->createIssue(1, $admin, $developer1, $project);
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->seeLink('Issue 1');
     $I->dontSee(\Html::duration($issue->time_quote), '.issue-quote');
     $I->click('Issue 1', '.edit-issue');
     $I->seeCurrentActionIs('Project\\IssueController@getEdit', ['project' => $project, 'issue' => $issue]);
     $newTitle = 'Issue 1 update';
     $newTime = 3700;
     $I->fillField('title', $newTitle);
     $I->fillField('time_quote[h]', 1);
     $I->fillField('time_quote[s]', 100);
     $I->fillField('tag', 'type:tag1');
     $I->click(trans('tinyissue.update_issue'));
     $I->seeResponseCodeIs(200);
     $I->seeCurrentActionIs('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->seeLink($newTitle);
     $I->see(\Html::duration($newTime), '.issue-quote');
     $I->see('type', '.issue-tag');
     $I->see('tag1', '.issue-tag');
 }
Пример #3
0
 public function tryingToCreateWithEmptyContent(FunctionalTester $I)
 {
     $I->disableMiddleware();
     $I->amOnRoute('microblog.home');
     $I->sendAjaxPostRequest(route('microblog.save'), array('text' => ''));
     // POST
     $I->seeResponseCodeIs(422);
 }
Пример #4
0
 public function ResponseOfInvalidSourceIsJson(Tester $I)
 {
     $I->wantToTest('response is JSON if we provide an Invalid Source');
     $I->haveHttpHeader("apikey", $this->apiInfo[Helper::CSV_ORDER_APIKEY]);
     $I->sendGET("currenttime", ["source" => 'blahblahblah']);
     $I->seeResponseCodeIs(401);
     $I->seeResponseIsJson();
 }
Пример #5
0
 public function updateItem(FunctionalTester $I, $scenario)
 {
     $I->wantTo('modify an existing item');
     $I->sendPUT('/vehicles/123', ['name' => 'Pansy updated']);
     $scenario->incomplete('work in progress');
     $I->seeResponseCodeIs(200);
     $I->seeResponseIsJson();
     $I->seeResponseContainsJson(['id' => 123, 'name' => 'Pansy updated']);
 }
 /**
  * @test
  * it should insert a comment when hitting the endpoint with valid params
  */
 public function it_should_insert_a_comment_when_hitting_the_endpoint_with_valid_params(\FunctionalTester $I)
 {
     $post_id = $I->havePostInDatabase(['post_title' => 'Some post']);
     $I->amOnPage('/');
     $wp_rest_nonce = $I->grabValueFrom('input[name="rest_nonce"]');
     $I->haveHttpHeader('X-WP-Nonce', $wp_rest_nonce);
     $I->sendAjaxPostRequest('/wp-json/idlikethis/v1/button-click', ['post_id' => $post_id, 'content' => 'Some Content']);
     $I->seeResponseCodeIs(200);
     $I->seeCommentInDatabase(['comment_post_ID' => $post_id]);
 }
Пример #7
0
 public function requireAuthenticationForRoute(FunctionalTester $I)
 {
     $I->haveEnabledFilters();
     $I->amOnPage('/secure');
     $I->seeCurrentUrlEquals('/auth/login');
     $I->see('Login');
     $I->amLoggedAs(User::create($this->userAttributes));
     $I->amOnPage('/secure');
     $I->seeResponseCodeIs(200);
     $I->see('Hello World');
 }
 /**
  * @param FunctionalTester $I
  * @param Project          $project
  * @param array            $issues1
  * @param array            $issues2
  *
  * @return void
  */
 protected function _assertExport(FunctionalTester $I, Project $project, array $issues1, array $issues2)
 {
     $I->seeResponseCodeIs(200);
     array_walk($issues1, function ($issue) use($I) {
         $I->see($issue->title);
     });
     $I->see($project->name);
     array_walk($issues2, function ($issue) use($I) {
         $I->dontSee($issue->title);
     });
 }
Пример #9
0
 public function requireAuthenticationForRoute(FunctionalTester $I)
 {
     $I->dontSeeAuthentication();
     $I->amOnPage('/secure');
     $I->seeCurrentUrlEquals('/auth/login');
     $I->see('Login');
     $I->amLoggedAs(User::firstOrNew($this->userAttributes));
     $I->amOnPage('/secure');
     $I->seeResponseCodeIs(200);
     $I->see('Hello World');
 }
 /**
  * @test
  * it should reset comments when post id is valid
  */
 public function it_should_reset_comments_when_post_id_is_valid(\FunctionalTester $I)
 {
     $post_id = $I->havePostInDatabase();
     $comment_ids = $I->haveManyCommentsInDatabase(3, $post_id, ['comment_type' => 'idlikethis']);
     $I->loginAsAdmin();
     $I->amEditingPostWithId($post_id);
     $wp_rest_nonce = $I->grabValueFrom('input[name="rest_nonce"]');
     $I->haveHttpHeader('X-WP-Nonce', $wp_rest_nonce);
     $I->sendAjaxPostRequest('/wp-json/idlikethis/v1/admin/reset-all', ['post_id' => $post_id]);
     $I->seeResponseCodeIs(200);
     foreach ($comment_ids as $comment_id) {
         $I->dontSeeCommentInDatabase(['comment_ID' => $comment_id, 'comment_post_ID' => $post_id]);
     }
 }
 /**
  * @test
  * it should consolidate comments when post id is valid and user can edit posts
  */
 public function it_should_consolidate_comments_when_post_id_is_valid_and_user_can_edit_posts(\FunctionalTester $I)
 {
     $post_id = $I->havePostInDatabase();
     $comment_ids = $I->haveManyCommentsInDatabase(3, $post_id, ['comment_type' => 'idlikethis', 'comment_content' => '{{n}} - foo']);
     $I->loginAsAdmin();
     $I->amEditingPostWithId($post_id);
     $wp_rest_nonce = $I->grabValueFrom('input[name="rest_nonce"]');
     $I->haveHttpHeader('X-WP-Nonce', $wp_rest_nonce);
     $I->sendAjaxPostRequest('/wp-json/idlikethis/v1/admin/consolidate-all', ['post_id' => $post_id]);
     $I->seeResponseCodeIs(200);
     foreach ($comment_ids as $comment_id) {
         $I->dontSeeCommentInDatabase(['comment_ID' => $comment_id, 'comment_post_ID' => $post_id]);
     }
     $I->seePostMetaInDatabase(['post_id' => $post_id, 'meta_key' => '_idlikethis_votes', 'meta_value' => serialize(['foo' => 3])]);
 }
Пример #12
0
 public function viewInvalidNote(FunctionalTester $I)
 {
     $I->am('Normal User');
     $I->expectTo('see 401 error with mismatch note route parameters.');
     $admin = $I->createUser(1, 4);
     // admin
     $project1 = $I->createProject(1, [$admin]);
     $project2 = $I->createProject(2, [$admin]);
     $note1 = $I->createNote(1, $admin, $project1);
     $I->amLoggedAs($admin);
     $I->amOnAction('ProjectController@getNotes', ['project' => $project1]);
     $uri = $I->getApplication()->url->action('ProjectController@postEditNote', ['project' => $project2, 'note' => $note1], false);
     $I->sendAjaxPostRequest($uri, ['body' => 'note one updated', '_token' => csrf_token()]);
     $I->seeResponseCodeIs(401);
 }
Пример #13
0
 public function memberCantAddCash(FunctionalTester $I)
 {
     $I->am('a member');
     $I->wantTo('make sure I cant add cash payments to my account');
     //Load and login a known member
     $user = User::find(1);
     Auth::login($user);
     //I cant see option
     $I->amOnPage('/account/' . $user->id . '');
     $I->cantSee('Record a cash balance payment');
     //Make sure they cant post payment directly
     //Confirm that posting directly generates a validation exception
     $I->sendPOST('/account/' . $user->id . '/payment/cash/create', ['reason' => 'balance', 'amount' => 4.69, 'return_path' => '/']);
     $I->seeResponseCodeIs(403);
     //One final check
     $I->cantSeeInDatabase('payments', ['amount' => 4.69]);
 }
Пример #14
0
 /**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function deleteComment(FunctionalTester $I)
 {
     $I->am('Developer User');
     $I->wantTo('delete a comment from an issue');
     $admin = $I->createUser(2, 4);
     $I->amLoggedAs($admin);
     $project = $I->createProject(1, [$admin]);
     $issue = $I->createIssue(1, $admin, $admin, $project);
     $comment1 = $I->createComment(1, $admin, $issue);
     $comment2 = $I->createComment(2, $admin, $issue);
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->see($comment1->comment, '#comment' . $comment1->id . ' .content');
     $I->see($comment2->comment, '#comment' . $comment2->id . ' .content');
     $uri = $I->getApplication()->url->action('Project\\IssueController@getDeleteComment', ['comment' => $comment1]);
     $I->sendAjaxGetRequest($uri);
     $I->seeResponseCodeIs(200);
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->dontSee($comment1->comment);
     $I->see($comment2->comment);
 }
Пример #15
0
 /**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function cantEditClosedIssue(FunctionalTester $I)
 {
     $I->am('Admin User');
     $I->wantTo('not be able to edit closed issue');
     $admin = $I->createUser(1, 4);
     $developer1 = $I->createUser(2, 2);
     // developer
     $I->amLoggedAs($admin);
     $project = $I->createProject(1, [$developer1]);
     $issue = $I->createIssue(1, $admin, $developer1, $project);
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->click('Issue 1', '.edit-issue');
     $I->seeCurrentActionIs('Project\\IssueController@getEdit', ['project' => $project, 'issue' => $issue]);
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->click(trans('tinyissue.close_issue'), '.close-issue');
     $I->seeLink(trans('tinyissue.reopen_issue'));
     $I->click('Issue 1', '.edit-issue');
     $I->seeResponseCodeIs(200);
     $I->seeCurrentActionIs('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->see(trans('tinyissue.cant_edit_closed_issue'));
 }
Пример #16
0
 public function tryToLinkUnlinkEvents(FunctionalTester $I)
 {
     $I->haveInCollection('Event', ['name' => 'event1']);
     $event1Id = (string) ($dbUser = $I->grabFromCollection('Event', ['name' => 'event1'])['_id']);
     $I->haveInCollection('Event', ['name' => 'event2']);
     $event2Id = (string) ($dbUser = $I->grabFromCollection('Event', ['name' => 'event2'])['_id']);
     $I->sendPUT('api/events/' . $event1Id . '/users/' . $this->userId . '.json');
     $I->seeResponseCodeIs(401);
     $I->sendDELETE('api/events/' . $event1Id . '/users/' . $this->userId . '.json');
     $I->seeResponseCodeIs(401);
     $I->login($this->user['email']);
     $I->sendPUT('api/events/' . $event1Id . '/users/' . $this->userId . '.json');
     $I->seeResponseCodeIs(204);
     $I->sendGET('api/users/current.json');
     $I->seeResponseContainsJson(['events' => [['id' => $event1Id]]]);
     $I->dontseeResponseContainsJson(['events' => [['id' => $event2Id]]]);
     $I->sendPUT('api/events/' . $event2Id . '/users/' . $this->userId . '.json');
     $I->seeResponseCodeIs(204);
     $I->sendGET('api/users/current.json');
     $I->seeResponseContainsJson(['events' => [['id' => $event1Id]]]);
     $I->seeResponseContainsJson(['events' => [['id' => $event2Id]]]);
     $I->sendDELETE('api/events/' . $event1Id . '/users/' . $this->userId . '.json');
     $I->seeResponseCodeIs(204);
     $I->sendGET('api/users/current.json');
     $I->seeResponseCodeIs(200);
     $I->dontseeResponseContainsJson(['events' => [['id' => $event1Id]]]);
     $I->seeResponseContainsJson(['events' => [['id' => $event2Id]]]);
     $I->sendGET('api/events/' . $event1Id . '.json');
     $I->seeResponseCodeIs(200);
     $I->dontseeResponseContainsJson(['users' => [['id' => $this->userId]]]);
     $I->sendGET('api/events/' . $event2Id . '.json');
     $I->seeResponseCodeIs(200);
     $I->seeResponseContainsJson(['users' => [['id' => $this->userId]]]);
     $I->sendPUT('api/events/' . $event2Id . '/users/' . $this->adminId . '.json');
     $I->seeResponseCodeIs(204);
     $I->sendGET('api/events/' . $event2Id . '.json');
     $I->seeResponseCodeIs(200);
     $I->seeResponseContainsJson(['users' => [['id' => $this->userId], ['id' => $this->adminId]]]);
 }
Пример #17
0
 public function OtherVerb(Tester $I)
 {
     $time = time();
     $I->wantTo('Test invalid Verb');
     $I->haveHttpHeader("apikey", $this->apikey);
     $I->haveHttpHeader("timestamp", $time);
     $I->haveHttpHeader("fingerprint", Helper::createFingerPrint($this->apikey, $this->secret, $time, 'POST', $this->resourceURL, $this->nric, $this->amount, $this->date, $this->source));
     $I->haveHttpHeader("Content-Type", 'application/x-www-form-urlencoded');
     $I->sendOPTIONS("updates", Helper::assemblePostData($this->nric, $this->amount, $this->date, $this->source));
     $I->seeResponseCodeIs(405);
 }
Пример #18
0
 public function tryToCreateModifyAndDeleteTeam(FunctionalTester $I)
 {
     $I->am('Anonymous user');
     $I->sendPOST('api/teams.json', $this->team3);
     $I->seeResponseCodeIs(401);
     $I->sendPUT('api/teams/' . $this->team2Id . '.json');
     $I->seeResponseCodeIs(401);
     $I->sendDELETE('api/teams/' . $this->team2Id . '.json');
     $I->seeResponseCodeIs(401);
     $I->am('ROLE_USER');
     $I->login($this->user['email']);
     $I->sendPOST('api/teams.json', $this->team3);
     $I->seeResponseCodeIs(403);
     $I->sendPUT('api/teams/' . $this->team2Id . '.json');
     $I->seeResponseCodeIs(403);
     $I->sendDELETE('api/teams/' . $this->team2Id . '.json');
     $I->seeResponseCodeIs(403);
     $I->am('ROLE_ADMIN');
     $I->login($this->admin['email']);
     $I->sendPOST('api/teams.json', $this->team3);
     $I->seeResponseCodeIs(200);
     $I->seeResponseContainsJson($this->team3);
     $id = $I->grabDataFromResponseByJsonPath('$.id')[0];
     $I->sendGET('api/teams/' . $id . '.json');
     $I->seeResponseCodeIs(200);
     $I->seeResponseContainsJson($this->team3);
     $I->sendGET('api/teams/' . $id . '.json');
     $I->seeResponseCodeIs(200);
     $I->seeResponseContainsJson($this->team3);
     $this->team3['name'] = 'new name';
     $I->sendPUT('api/teams/' . $id . '.json', $this->team3);
     $I->seeResponseCodeIs(200);
     $I->seeResponseContainsJson($this->team3);
     $I->sendGET('api/teams/' . $id . '.json');
     $I->seeResponseCodeIs(200);
     $I->seeResponseContainsJson($this->team3);
     $I->sendDELETE('api/teams/' . $id . '.json');
     $I->seeResponseCodeIs(204);
     $I->sendGET('api/teams/' . $id . '.json');
     $I->seeResponseCodeIs(404);
 }
Пример #19
0
<?php

$I = new FunctionalTester($scenario);
$I->wantTo('Getting Http response 200');
$I->amOnPage('/ny');
$I->seeResponseCodeIs(200);
Пример #20
0
 public function tryToCreateModifyAndDeleteEvent(FunctionalTester $I)
 {
     $I->am('Anonymous user');
     $I->sendPOST('api/events.json', $this->event3);
     $I->seeResponseCodeIs(401);
     $I->sendPUT('api/events/' . $this->event2Id . '.json');
     $I->seeResponseCodeIs(401);
     $I->sendDELETE('api/events/' . $this->event2Id . '.json');
     $I->seeResponseCodeIs(401);
     $I->am('ROLE_USER');
     $I->login($this->user['email']);
     $I->sendPOST('api/events.json', $this->event3);
     $I->seeResponseCodeIs(400);
     $this->event3['type'] = 'conference';
     $I->sendPOST('api/events.json', $this->event3);
     $I->seeResponseCodeIs(200);
     $I->seeResponseContainsJson($this->event3);
     $id = $I->grabDataFromResponseByJsonPath('$.id')[0];
     $I->sendGET('api/events/' . $id . '.json');
     $I->seeResponseCodeIs(200);
     $I->seeResponseContainsJson($this->event3);
     $this->event3['name'] = 'new name';
     $I->sendPUT('api/events/' . $id . '.json', $this->event3);
     $I->seeResponseCodeIs(200);
     $I->seeResponseContainsJson($this->event3);
     $I->sendGET('api/events/' . $id . '.json');
     $I->seeResponseCodeIs(200);
     $I->seeResponseContainsJson($this->event3);
     $I->sendDELETE('api/events/' . $id . '.json');
     $I->seeResponseCodeIs(204);
     $I->sendGET('api/events/' . $id . '.json');
     $I->seeResponseCodeIs(404);
     $I->sendPOST('api/events.json', $this->event4);
     $I->seeResponseCodeIs(200);
     $this->event4['dateEnd'] = $this->event4['dateStart'];
     $I->seeResponseContainsJson($this->event4);
     $id = $I->grabDataFromResponseByJsonPath('$.id')[0];
     $this->event4['data'] = ['some' => ['custom', 'data'], 'to' => ['check' => 'if arbitrary data can be stored']];
     $I->sendPUT('api/events/' . $id . '.json', $this->event4);
     $I->sendGET('api/events/' . $id . '.json');
     $I->seeResponseCodeIs(200);
     $I->seeResponseContainsJson($this->event4);
 }
Пример #21
0
 public function deactivate_user(FunctionalTester $I)
 {
     $I->am('Admin');
     $I->wantTo('deactivate a user');
     $I->expectTo('see that the user has been deactivated');
     /***************************************************************************************************************
      * settings
      **************************************************************************************************************/
     // we create the admin role
     $admin_role = $this->_createAdminRole();
     $admin_role->users()->attach($this->_user);
     // we create another user
     $credentials = ['last_name' => 'Autre', 'first_name' => 'autre', 'email' => '*****@*****.**', 'password' => 'autre'];
     $user = \Sentinel::register($credentials, true);
     /***************************************************************************************************************
      * run test
      **************************************************************************************************************/
     $I->amOnPage('/');
     $I->amOnRoute('users.index');
     $I->uncheckOption('#activate_' . $user->id);
     $I->submitForm('#form_activate_' . $user->id, []);
     $I->seeResponseCodeIs(200);
     //        $I->see(strip_tags(trans('users.message.activation.success.label', ['action' => trans_choice('users.message.activation.success.action', false), 'name' => $user->first_name . ' ' . $user->last_name])));
     $I->dontSeeRecord('activations', ['user_id' => $user->id, 'completed' => true]);
 }
Пример #22
0
 /**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function removeUserFromProject(FunctionalTester $I)
 {
     $I->am('Admin User');
     $I->wantTo('not be able to remove user to a project');
     $admin = $I->createUser(1, 4);
     $developer1 = $I->createUser(2, 2);
     // developer
     $I->amLoggedAs($admin);
     $project = $I->createProject(1, [$developer1]);
     $I->amOnAction('ProjectController@getIndex', ['project' => $project]);
     $I->see($developer1->fullname, '#project-user' . $developer1->id);
     $uri = $I->getApplication()->url->action('ProjectController@postUnassign', ['project' => $project]);
     $I->sendAjaxPostRequest($uri, ['user_id' => $developer1->id, '_token' => csrf_token()]);
     $I->seeResponseCodeIs(200);
     $I->amOnAction('ProjectController@getIndex', ['project' => $project]);
     $I->dontSee($developer1->fullname, '#project-user' . $developer1->id);
 }
 /**
  * @param FunctionalTester $I
  * @param string|array     $action
  * @param string           $expectTo
  *
  * @return void
  */
 protected function _cantAccessPage(FunctionalTester $I, $action, $expectTo)
 {
     $action = is_array($action) ? $action : [$action];
     $I->am('Developer User');
     $I->expectTo('not be able to ' . $expectTo);
     $I->amLoggedAs($I->createUser(1, 2));
     call_user_func_array([$I, 'amOnAction'], $action);
     $I->seeResponseCodeIs(401);
 }
Пример #24
0
<?php

// @group mandatory
$I = new FunctionalTester($scenario);
$I->wantTo('ensure that error page works');
$I->amOnPage('/_this_page_does_not_exist_');
$I->seeResponseCodeIs(404);
$I->see('Not Found');
<?php

use BB\Entities\User;
$I = new FunctionalTester($scenario);
$I->am('a member');
$I->wantTo('confirm I cant see other peoples edit page');
//Load and login a known member
$user = User::find(1);
Auth::login($user);
$otherUser = User::find(3);
$I->amOnPage('/account/' . $otherUser->id . '/profile/edit');
$I->seeResponseCodeIs(403);
Пример #26
0
 public function deactivate_slide(FunctionalTester $I)
 {
     $I->am('Admin');
     $I->wantTo('deactivate a slide');
     $I->expectTo('see that the user has been deactivated');
     /***************************************************************************************************************
      * settings
      **************************************************************************************************************/
     // we create the admin role
     $admin_role = $this->_createAdminRole();
     // we attach it to the logged user
     $admin_role->users()->attach($this->_user);
     // we create a slide
     $this->_createSlide();
     /***************************************************************************************************************
      * run test
      **************************************************************************************************************/
     $I->amOnPage('/');
     $I->amOnRoute('home.edit');
     $I->uncheckOption('#activate_' . $this->_slide->id);
     $I->submitForm('#form_activate_' . $this->_slide->id, []);
     $I->seeResponseCodeIs(200);
     //        $I->see(strip_tags(trans('home.message.slide.activation.success.label', ['action' => trans_choice('users.message.activation.success.action', false), 'slide' => $this->_slide->title])));
     $I->seeRecord('slides', ['id' => $this->_slide->id, 'active' => false]);
 }
Пример #27
0
 public function openRouteWithDomainSpecified(FunctionalTester $I)
 {
     $I->amOnRoute('domain');
     $I->seeResponseCodeIs(200);
     $I->see('Domain route');
 }
Пример #28
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);
 }
Пример #29
0
 /**
  * @param \FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function cantCreateUser(FunctionalTester $I)
 {
     $I->am('Manager User');
     $I->expectTo('not be able to create new user');
     $I->amLoggedAs($I->createUser(1, 3));
     $I->amOnAction('Administration\\UsersController@getAdd');
     $I->seeResponseCodeIs(401);
 }
Пример #30
0
 /**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function deleteNote(FunctionalTester $I)
 {
     $I->am('Admin User');
     $I->wantTo('delete an existing note from a project');
     $admin = $I->createUser(1, 4);
     $I->amLoggedAs($admin);
     $project = $I->createProject(1);
     $note1 = $I->createNote(1, $admin, $project);
     $note2 = $I->createNote(2, $admin, $project);
     $I->amOnAction('ProjectController@getNotes', ['project' => $project]);
     $I->see('Note 1', '//li[@id="note' . $note1->id . '"]');
     $I->see('Note 2', '//li[@id="note' . $note2->id . '"]');
     $uri = $I->getApplication()->url->action('ProjectController@getDeleteNote', ['project' => $project, 'note' => $note2]);
     $I->sendAjaxGetRequest($uri);
     $I->seeResponseCodeIs(200);
     $I->amOnAction('ProjectController@getNotes', ['project' => $project]);
     $I->see('Note 1', '//li[@id="note' . $note1->id . '"]');
     $I->dontSee('Note 2', '//li[@id="note' . $note2->id . '"]');
 }