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


PHP ApiTester::sendDELETE方法代码示例

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


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

示例1: deletePost

 public function deletePost(ApiTester $I)
 {
     $id = $I->haveRecord('posts', $this->getPostAttributes(['title' => 'Game of Thrones']));
     $I->sendDELETE($this->endpoint . "/{$id}");
     $I->seeResponseCodeIs(200);
     $I->dontSeeRecord('posts', ['id' => $id]);
 }
开发者ID:resulaslan,项目名称:sample-l4-app,代码行数:7,代码来源:PostsResourceCest.php

示例2: deleteUser

 public function deleteUser(ApiTester $I, \Codeception\Scenario $scenario)
 {
     //$scenario->skip('ownCloud master is broken');
     $I->wantTo('delete the user');
     $I->amHttpAuthenticated('admin', 'admin');
     $I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
     $I->sendDELETE($this->apiUrl . '/users/' . $this->userId);
     $I->seeResponseCodeIs(200);
     $I->seeResponseIsXml();
     $I->seeXmlResponseIncludes(XmlUtils::toXml(['status' => 'ok']));
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:11,代码来源:OcsCreateUserCest.php

示例3: delete

 /**
  * @depends update
  */
 public function delete(ApiTester $I)
 {
     $I->wantTo('Delete a new Contact in com_contacts using DELETE');
     $I->amHttpAuthenticated('admin', 'admin');
     $I->sendDELETE('index.php' . '?option=contact' . '&api=Hal' . '&webserviceClient=administrator' . '&webserviceVersion=1.0.0' . "&id={$this->id}");
     $I->seeResponseCodeIs(200);
     $I->sendGET('index.php' . '?option=contact' . '&api=Hal' . '&webserviceClient=administrator' . '&webserviceVersion=1.0.0' . "&id={$this->id}");
     $I->seeResponseCodeIs(404);
     $I->seeResponseIsJson();
     $I->seeResponseContains('"message":"Item not found with given key.","code":404,"type":"Exception"');
 }
开发者ID:thangredweb,项目名称:redCORE,代码行数:14,代码来源:administrator.contact.1.0.0.Cest.php

示例4: deleteDiscussion

 public function deleteDiscussion(ApiTester $I)
 {
     $I->wantTo('delete a discussion via API');
     $user = $I->amAuthenticated();
     $user->groups()->attach(4);
     // Make the user a moderator
     $discussion = Factory::create('Flarum\\Core\\Models\\Discussion', ['start_user_id' => $user->id]);
     $I->sendDELETE($this->endpoint . '/' . $discussion->id);
     $I->seeResponseCodeIs(204);
     $I->seeResponseEquals('');
     $I->expect('the discussion was deleted in the database');
     $I->dontSeeRecord('discussions', ['id' => $discussion->id]);
 }
开发者ID:Qiang1234,项目名称:core,代码行数:13,代码来源:DiscussionsResourceCest.php

示例5: delete

 public function delete(ApiTester $I)
 {
     $I->createAndLoginUser();
     $I->createProjectAndSetHeader();
     $I->createTable();
     $I->createTable();
     $I->sendGET('api/v1/admin/tables');
     $I->assertListTable();
     $response = $I->getResponseFields();
     $id = $response->data[0]->_id;
     $id2 = $response->data[1]->_id;
     $I->sendDELETE('api/v1/admin/tables/' . $id);
     $I->sendGET('api/v1/admin/tables/' . $id);
     $I->seeResponseCodeIs(404);
     $I->sendGET('api/v1/admin/tables/' . $id2);
     $I->assertTable();
 }
开发者ID:Nebo15,项目名称:gandalf.api,代码行数:17,代码来源:TablesCest.php

示例6: ApiTester

<?php

$I = new ApiTester($scenario);
$I->wantTo('delete a device');
$user = $I->haveAnAccount();
$I->amHttpAuthenticated($user['email'], $user['password']);
$piOne = $I->haveRecord('devices', ['ip' => '192.168.1.101', 'mac' => '11:22:33:44:55:66', 'name' => 'Awesome Pi One', 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
$I->sendDELETE('devices/1');
$I->seeResponseCodeIs(204);
$I->cantSeeRecord('devices', ['ip' => '192.168.1.101']);
$I->sendDELETE('devices/1000');
$I->seeResponseCodeIs(404);
$I->seeResponseIsJson();
开发者ID:4mb,项目名称:pi.strebl.ch,代码行数:13,代码来源:DeleteDeviceCept.php

示例7: count

\PHPUnit_Framework_Assert::assertEquals(2, count($teams));
// Join one player to the team
$I->sendPUT("/teams/{$teamId}", ['join_player' => 'w@w.w']);
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$players = $I->grabDataFromResponseByJsonPath('$.players')[0];
\PHPUnit_Framework_Assert::assertEquals(2, count($players));
// Remove player from the team
$I->sendPUT("/teams/{$teamId}", ['remove_player' => 'w@w.w']);
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$players = $I->grabDataFromResponseByJsonPath('$.players')[0];
\PHPUnit_Framework_Assert::assertEquals(1, count($players));
// update team name
$I->sendPUT("/teams/{$teamId}", ['name' => 'QA2']);
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContains('"name":"QA2"');
// delete team
$I->sendDELETE("/teams/{$teamId}");
$I->seeResponseCodeIs(204);
$I->sendGET('/players/33?expand=teams');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContains('teams');
$teams = $I->grabDataFromResponseByJsonPath('$.teams[0]');
\PHPUnit_Framework_Assert::assertEquals(1, count($teams));
// check that all other routes are disabled
// index
$I->sendGET('/teams');
$I->seeResponseCodeIs(405);
开发者ID:AndriyK,项目名称:team,代码行数:31,代码来源:TeamsCept.php

示例8: substr

$I->seeResponseCodeIs(200);
$I->sendGET("/-/vaults/testvault/jobs/{$jobID}");
$I->seeResponseCodeIs(200);
$I->seeResponseContainsJson(['StatusCode' => 'Succeeded']);
$I->sendGET("/-/vaults/testvault/jobs/{$jobID}/output");
$I->seeResponseCodeIs(200);
$this->assertTrue($I->grabResponse() === $data);
$I->haveHttpHeader('Range', 'bytes=0-1');
$I->sendGET("/-/vaults/testvault/jobs/{$jobID}/output");
$I->seeResponseCodeIs(206);
$this->assertTrue($I->grabResponse() === 'AB');
$I->haveHttpHeader('Range', 'bytes=2-3');
$I->sendGET("/-/vaults/testvault/jobs/{$jobID}/output");
$I->seeResponseCodeIs(206);
$this->assertTrue($I->grabResponse() === 'CD');
$I->haveHttpHeader('Content-Type', 'application/json');
$I->sendPOST('/-/vaults/testvault/jobs', ['Type' => 'archive-retrieval', 'ArchiveId' => $archiveID, 'RetrievalByteRange' => '1-1048575']);
$I->seeResponseCodeIs(202);
$jobID = $I->grabHttpHeader('x-amz-job-id');
$I->sendPOST("/-/vaults/testvault/jobs/{$jobID}/force-complete", []);
$I->seeResponseCodeIs(200);
$I->haveHttpHeader('Range', '');
$I->sendGET("/-/vaults/testvault/jobs/{$jobID}/output");
$I->seeResponseCodeIs(200);
$this->assertTrue($I->grabResponse() === substr($data, 1, 1024 * 1024 - 1));
$I->haveHttpHeader('Range', 'bytes=0-1');
$I->sendGET("/-/vaults/testvault/jobs/{$jobID}/output");
$I->seeResponseCodeIs(206);
$this->assertTrue($I->grabResponse() === $data[1] . $data[2]);
$I->sendDELETE("/-/vaults/testvault/archives/{$archiveID}");
$I->seeResponseCodeIs(204);
开发者ID:sebcode,项目名称:gsandbox,代码行数:31,代码来源:RetrieveArchiveCept.php

示例9: ApiTester

<?php

$scenario->group('ListModule');
$I = new ApiTester($scenario);
$I->wantTo('delete a element of the users List');
$I->sendDELETE('/list/elements', ['elementId' => 5]);
$I->seeResponseCodeIs(200);
$I->seeResponseEquals('');
开发者ID:skluetsch,项目名称:RESTShoppingList,代码行数:8,代码来源:removeElementFromUsersListCept.php

示例10: ApiTester

<?php

$user_data = ['name' => 'Player 1', 'email' => 'test@mail.com', 'password' => 'test', 'password_repeat' => 'test'];
$I = new ApiTester($scenario);
$I->wantTo('check players resource');
// creating new player
$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
$I->sendPOST('/players', $user_data);
$I->seeResponseCodeIs(201);
$I->seeResponseIsJson();
$I->seeResponseContains('token');
// already existing player
$user_data['email'] = 'q@q.q';
$I->sendPOST('/players', $user_data);
$I->seeResponseCodeIs(422);
$I->seeResponseIsJson();
$I->seeResponseContains('Email \\"q@q.q\\" has already been taken.');
// check that all other routes are disabled
// index
$I->sendGET('/players');
$I->seeResponseCodeIs(404);
$I->seeResponseContains('Page not found.');
// update
$I->sendPUT('/players/33', ['name' => 'updated_name']);
$I->seeResponseCodeIs(404);
$I->seeResponseContains('Page not found.');
// update
$I->sendDELETE('/players/33');
$I->seeResponseCodeIs(404);
$I->seeResponseContains('Page not found.');
开发者ID:AndriyK,项目名称:team,代码行数:30,代码来源:PlayerCept.php

示例11: ApiTester

<?php

Yii::$app->redis->executeCommand('FLUSHDB');
use Codeception\Util\Debug;
$model = new \app\models\Message();
$model->author_email = 'test@gmail.com';
$model->author_name = 'test';
$model->message = str_repeat('A', 140);
$model->save();
$I = new ApiTester($scenario);
$I->wantTo('Excluir uma mensagem');
$I->sendDELETE('messages', ['' => $model->id]);
$I->seeResponseIsJson();
$I->seeResponseContainsJson([]);
开发者ID:jsopra,项目名称:lepetitmessager,代码行数:14,代码来源:DeleteCept.php

示例12: ApiTester

<?php

$I = new ApiTester($scenario);
$I->wantTo('List vaults.');
$I->haveAuth();
$I->sendPUT('/-/vaults/testvault1');
$I->seeResponseCodeIs(201);
$I->sendPUT('/-/vaults/testvault2');
$I->seeResponseCodeIs(201);
$I->sendPUT('/-/vaults/testvault3');
$I->seeResponseCodeIs(201);
$I->sendGET('/-/vaults');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseJsonMatchesJsonPath('$.VaultList');
$I->seeResponseJsonMatchesJsonPath('$.VaultList[*].VaultName');
$I->seeResponseJsonMatchesJsonPath('$.VaultList[*].CreationDate');
$I->seeResponseJsonMatchesJsonPath('$.VaultList[*].LastInventoryDate');
$I->seeResponseJsonMatchesJsonPath('$.VaultList[*].NumberOfArchives');
$I->seeResponseJsonMatchesJsonPath('$.VaultList[*].SizeInBytes');
$I->seeResponseJsonMatchesJsonPath('$.VaultList[*].VaultARN');
$I->sendDELETE('/-/vaults/testvault1');
$I->seeResponseCodeIs(204);
$I->sendDELETE('/-/vaults/testvault2');
$I->seeResponseCodeIs(204);
$I->sendDELETE('/-/vaults/testvault3');
$I->seeResponseCodeIs(204);
开发者ID:sebcode,项目名称:gsandbox,代码行数:27,代码来源:ListVaultsCept.php

示例13: ApiTester

<?php

$I = new ApiTester($scenario);
$I->wantTo('Create a new vault.');
$I->sendPUT('/-/vaults/testvault');
$I->seeResponseCodeIs(403);
$I->haveAuth();
$I->sendPUT('/-/vaults/testvault');
$I->seeResponseCodeIs(201);
$I->seeResponseEquals('');
$I->haveAuth();
$I->sendDELETE('/-/vaults/testvault');
$I->seeResponseCodeIs(204);
$I->seeResponseEquals('');
开发者ID:sebcode,项目名称:gsandbox,代码行数:14,代码来源:CreateVaultCept.php

示例14:

    $I->sendPOST('cart/coupon', ['code' => $coupon['code']]);
    $I->seeCodeAndJson(HTTP_OK, $coupon);
    $I->sendGET('cart');
    $I->seeResponseContainsJson(['total' => $calculate_discount($coupon['discount'], $item1, $item2)]);
};
$I->amGoingTo('use a valid coupon code');
$set_coupon($coupons[0]);
$I->amGoingTo('change the coupon');
$set_coupon($coupons[1]);
$I->amGoingTo('add a new item to see the price discount');
$item3 = $gen_item();
$I->sendPUT('cart', $item3);
$item3['final_price'] = $item3['price'] * $item3['qty'];
$I->sendGET('cart');
$I->seeResponseContainsJson(['total' => $calculate_discount($coupons[1]['discount'], $item1, $item2, $item3)]);
$I->amGoingTo('remove the wrong coupon');
$I->sendDELETE('cart/coupon?code=' . $coupons[0]['code']);
$I->seeResponseCodeIs(HTTP_CONFLICT);
$I->amGoingTo('remove a weird coupon');
$I->sendDELETE('cart/coupon?code=' . $faker->lexify('??????????'));
$I->seeResponseCodeIs(HTTP_NOT_FOUND);
$I->amGoingTo('remove the right coupon');
$I->sendDELETE('cart/coupon?code=' . $coupons[1]['code']);
$I->seeResponseCodeIs(HTTP_NO_CONTENT);
$I->amGoingTo('remove the right coupon again');
$I->sendDELETE('cart/coupon?code=' . $coupons[1]['code']);
$I->seeResponseCodeIs(HTTP_EXPECTATION_FAILED);
$I->amGoingTo('verify order value without discounts');
$I->sendGET('cart');
$I->seeResponseContainsJson(['total' => $calculate_discount(0, $item1, $item2, $item3)]);
//we should not test a checkout with the coupon since this would be an integration test (?), and we're already testing the order total up there anyway
开发者ID:igorsantos07,项目名称:developer-shop,代码行数:31,代码来源:CouponCept.php

示例15: count

$gameId = $I->grabDataFromResponseByJsonPath('$.id')[0];
$I->sendGET('/teams/26?expand=games');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContains('games');
$games = $I->grabDataFromResponseByJsonPath('$.games')[0];
\PHPUnit_Framework_Assert::assertEquals(3, count($games));
// Join one player to the game
$I->sendPUT("/games/{$gameId}", ['join_player' => 33]);
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
// Remove player from the game
$I->sendPUT("/games/{$gameId}", ['reject_player' => 33]);
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
// delete game
$I->sendDELETE("/games/{$gameId}");
$I->seeResponseCodeIs(204);
$I->sendGET('/teams/26?expand=games');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContains('games');
$games = $I->grabDataFromResponseByJsonPath('$.games')[0];
\PHPUnit_Framework_Assert::assertEquals(2, count($games));
// check that all other routes are disabled
// index
$I->sendGET('/games');
$I->seeResponseCodeIs(405);
//view
$I->sendGET('/games/2');
$I->seeResponseCodeIs(405);
开发者ID:AndriyK,项目名称:team,代码行数:31,代码来源:GamesCept.php


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