当前位置: 首页>>代码示例>>PHP>>正文


PHP FunctionalTester::sendAjaxPostRequest方法代码示例

本文整理汇总了PHP中FunctionalTester::sendAjaxPostRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP FunctionalTester::sendAjaxPostRequest方法的具体用法?PHP FunctionalTester::sendAjaxPostRequest怎么用?PHP FunctionalTester::sendAjaxPostRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FunctionalTester的用法示例。


在下文中一共展示了FunctionalTester::sendAjaxPostRequest方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _exportIssues

 /**
  * @param FunctionalTester $I
  * @param Project          $project
  * @param array            $params
  *
  * @return void
  */
 protected function _exportIssues(FunctionalTester $I, Project $project, array $params)
 {
     $I->amOnAction('ProjectController@getIndex', ['project' => $project]);
     $uri = $I->getApplication()->url->action('ProjectController@postExportIssues', ['project' => $project]);
     $I->sendAjaxPostRequest($uri, array_merge(['_token' => csrf_token(), 'keyword' => '', 'assignto' => '', 'tags' => ''], $params));
     $I->seeResponseCodeIs(200);
 }
开发者ID:oliverpool,项目名称:tinyissue,代码行数:14,代码来源:ExportProjectIssueCest.php

示例2: tryingToCreateWithEmptyContent

 public function tryingToCreateWithEmptyContent(FunctionalTester $I)
 {
     $I->disableMiddleware();
     $I->amOnRoute('microblog.home');
     $I->sendAjaxPostRequest(route('microblog.save'), array('text' => ''));
     // POST
     $I->seeResponseCodeIs(422);
 }
开发者ID:furious-programming,项目名称:coyote,代码行数:8,代码来源:MicroblogsCest.php

示例3: it_should_insert_a_comment_when_hitting_the_endpoint_with_valid_params

 /**
  * @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]);
 }
开发者ID:lucatume,项目名称:idlikethis,代码行数:14,代码来源:ButtonClickPostRequestCest.php

示例4: it_should_reset_comments_when_post_id_is_valid

 /**
  * @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]);
     }
 }
开发者ID:lucatume,项目名称:idlikethis,代码行数:18,代码来源:ResetAllPostRequestCest.php

示例5: viewInvalidNote

 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);
 }
开发者ID:oliverpool,项目名称:tinyissue,代码行数:15,代码来源:OtherFunctionalCest.php

示例6: it_should_consolidate_comments_when_post_id_is_valid_and_user_can_edit_posts

 /**
  * @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])]);
 }
开发者ID:lucatume,项目名称:idlikethis,代码行数:19,代码来源:ConsolidateAllPostRequestCest.php

示例7: updateNote

 /**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function updateNote(FunctionalTester $I)
 {
     $I->am('Admin User');
     $I->wantTo('edit an existing note in the project');
     $admin = $I->createUser(1, 4);
     $I->amLoggedAs($admin);
     $note = $I->createNote(1, $admin);
     $project = $note->project;
     $I->amOnAction('ProjectController@getNotes', ['project' => $project]);
     $I->see('Note 1', '//li[@id="note' . $note->id . '"]');
     $uri = $I->getApplication()->url->action('ProjectController@postEditNote', ['project' => $project, 'note' => $note]);
     $I->sendAjaxPostRequest($uri, ['body' => 'note one updated', '_token' => csrf_token()]);
     $I->seeResponseCodeIs(200);
     $I->amOnAction('ProjectController@getNotes', ['project' => $project]);
     $I->see('note one updated', '//li[@id="note' . $note->id . '"]');
 }
开发者ID:oliverpool,项目名称:tinyissue,代码行数:23,代码来源:CrudProjectNotesCest.php

示例8: FunctionalTester

<?php

$I = new FunctionalTester($scenario);
$I->am('HRis User');
$I->wantTo('Delete Qualifications(Work Experience). [Positive Test]');
# Authorize User
$I->amOnPage('/auth/login');
$I->fillField('email', 'bertrand@verticalops.com');
$I->fillField('password', 'retardko');
$I->click('Login');
# Dashboard
$I->seeCurrentUrlEquals('/dashboard');
# Profile
$I->click('Profile');
$I->seeCurrentUrlEquals('/profile/personal-details');
# Qualifications
$I->click('Qualifications');
$I->seeCurrentUrlEquals('/profile/qualifications');
# Delete record
$I->see('Tested');
$id = $I->grabAttributeFrom('button[title=Edit]', 'id');
$token = $I->grabAttributeFrom('input[name=_token]', 'value');
$I->fillField('input[name=work_experience_id]', $id);
$I->sendAjaxPostRequest('/ajax/profile/qualifications/work-experience', ['id' => $id, '_token' => $token, '_method' => 'DELETE']);
// POST
$I->dontSee('Tested');
开发者ID:dobidobz,项目名称:HRis,代码行数:26,代码来源:03-DeleteQualificationsPositiveCept.php

示例9: FunctionalTester

<?php

$I = new FunctionalTester($scenario);
$I->am('HRis User');
$I->wantTo('Delete My Job Details. [Positive Test]');
# Authorize User
$I->amOnPage('/auth/login');
$I->fillField('email', 'bertrand@verticalops.com');
$I->fillField('password', 'retardko');
$I->click('Login');
# Dashboard
$I->seeCurrentUrlEquals('/dashboard');
# Profile
$I->click('Profile');
$I->seeCurrentUrlEquals('/profile/personal-details');
# Job
$I->click('Job');
$I->seeCurrentUrlEquals('/profile/job');
# Delete Job record
$I->click('Modify');
$I->seeCurrentUrlEquals('/profile/job/edit');
$I->see('Sr Web Designer');
$id = $I->grabAttributeFrom('button[title=Delete]', 'id');
$token = $I->grabAttributeFrom('input[name=_token]', 'value');
$I->sendAjaxPostRequest('/ajax/profile/job/edit', ['id' => $id, '_token' => $token, '_method' => 'DELETE']);
// POST
$I->dontSee('Test Suite');
开发者ID:dobidobz,项目名称:HRis,代码行数:27,代码来源:02-DeleteJobPositiveCept.php

示例10: FunctionalTester

<?php

$I = new FunctionalTester($scenario);
$I->am('HRis User');
$I->wantTo('Delete Emergency Contact. [Positive Test]');
# Authorize User
$I->amOnPage('/auth/login');
$I->fillField('email', 'bertrand@verticalops.com');
$I->fillField('password', 'retardko');
$I->click('Login');
# Dashboard
$I->seeCurrentUrlEquals('/dashboard');
# Profile
$I->click('Profile');
$I->seeCurrentUrlEquals('/profile/personal-details');
# Emergency Contacts
$I->click('Emergency Contacts');
$I->seeCurrentUrlEquals('/profile/emergency-contacts');
# Delete record
$I->see('Tested  Suited');
$id = $I->grabAttributeFrom('button[title=Delete]', 'id');
$token = $I->grabAttributeFrom('input[name=_token]', 'value');
$I->fillField('input[name=emergency_contact_id]', $id);
$I->sendAjaxPostRequest('/ajax/profile/emergency-contacts', ['id' => $id, '_token' => $token, '_method' => 'DELETE']);
// POST
$I->dontSee('Tested  Suited');
开发者ID:dobidobz,项目名称:HRis,代码行数:26,代码来源:03-DeleteEmergencyContactPositiveCept.php

示例11: removeUserFromProject

 /**
  * @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);
 }
开发者ID:oliverpool,项目名称:tinyissue,代码行数:24,代码来源:ProjectCest.php

示例12: FunctionalTester

<?php

$I = new FunctionalTester($scenario);
$I->am('HRis User');
$I->wantTo('Delete Dependent. [Positive Test]');
# Authorize User
$I->amOnPage('/auth/login');
$I->fillField('email', 'bertrand@verticalops.com');
$I->fillField('password', 'retardko');
$I->click('Login');
# Dashboard
$I->seeCurrentUrlEquals('/dashboard');
# Profile
$I->click('Profile');
$I->seeCurrentUrlEquals('/profile/personal-details');
# Dependents
$I->click('Dependents');
$I->seeCurrentUrlEquals('/profile/dependents');
# Delete record
$I->see('Tested  Suited');
$id = $I->grabAttributeFrom('button[title=Edit]', 'id');
$I->click("button[title=Edit][id={$id}]");
$id = $I->grabAttributeFrom('button[title=Delete]', 'id');
$token = $I->grabAttributeFrom('input[name=_token]', 'value');
$I->click("button[title=Delete][id={$id}]");
$I->fillField('input[name=dependent_id]', $id);
$I->sendAjaxPostRequest('/ajax/profile/dependents', ['id' => $id, '_token' => $token, '_method' => 'DELETE']);
// POST
$I->dontSee('Tested  Suited');
开发者ID:dobidobz,项目名称:HRis,代码行数:29,代码来源:03-DeleteDependentsPositiveCept.php

示例13: assignToUser

 /**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function assignToUser(FunctionalTester $I)
 {
     $I->am('Admin User');
     $I->wantTo('not be able to assign an issue to a user');
     $admin = $I->createUser(1, 4);
     $developer1 = $I->createUser(2, 2);
     // developer
     $I->amLoggedAs($admin);
     $project = $I->createProject(1, [$developer1]);
     $issue = $I->createIssue(1, $admin, null, $project);
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->dontSee($developer1->fullname, '.assigned-to .currently_assigned');
     $uri = $I->getApplication()->url->action('Project\\IssueController@postAssign', ['project' => $project]);
     $I->sendAjaxPostRequest($uri, ['user_id' => $developer1->id, '_token' => csrf_token()]);
     $I->comment($I->getResponseContent());
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->see($developer1->fullname, '.assigned-to .currently_assigned');
 }
开发者ID:oliverpool,项目名称:tinyissue,代码行数:25,代码来源:IssueCest.php

示例14: removeAttachment

 /**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function removeAttachment(FunctionalTester $I)
 {
     $I->am('Manager User');
     $I->wantTo('remove an attachment from a project issue comments');
     $fileName = 'upload1.txt';
     $manager = $I->createUser(1, 3);
     $I->amLoggedAs($manager);
     $issue = $I->createIssue(1, $manager);
     $project = $issue->project;
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $uploadToken = $I->grabValueFrom('//form/input[@name="upload_token"]');
     $uri = $I->getApplication()->url->action('Project\\IssueController@postUploadAttachment', ['project' => $project]);
     $I->submitFormWithFileToUri('.new-comment form', $uri, ['upload' => $fileName], ['comment' => 'Comment 1']);
     $attachment = $issue->comments->first()->attachments->first();
     $I->amOnAction('Project\\IssueController@getDownloadAttachment', ['project' => $project, 'issue' => $issue, 'attachment' => $attachment]);
     $I->seeResponseCodeIs(200);
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->seeElement('.attachments a', ['title' => $fileName]);
     $uri = $I->getApplication()->url->action('Project\\IssueController@postRemoveAttachment', ['project' => $project]);
     $I->sendAjaxPostRequest($uri, ['_token' => csrf_token(), 'upload_token' => $uploadToken, 'filename' => $fileName]);
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->dontSeeElement('.attachments a', ['title' => $fileName]);
     $I->amOnAction('Project\\IssueController@getDisplayAttachment', ['project' => $project, 'issue' => $issue, 'attachment' => $attachment]);
     $I->seeResponseCodeIs(404);
 }
开发者ID:oliverpool,项目名称:tinyissue,代码行数:32,代码来源:CrudAttachmentCest.php


注:本文中的FunctionalTester::sendAjaxPostRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。