本文整理汇总了PHP中ApiTester::wantTo方法的典型用法代码示例。如果您正苦于以下问题:PHP ApiTester::wantTo方法的具体用法?PHP ApiTester::wantTo怎么用?PHP ApiTester::wantTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApiTester
的用法示例。
在下文中一共展示了ApiTester::wantTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete(ApiTester $I)
{
$I->wantTo('delete 1 contact in Joomla using SOAP');
$I->amHttpAuthenticated('admin', 'admin');
$I->sendSoapRequest('delete', ['id' => $this->id]);
$I->seeSoapResponseIncludes("<result>true</result>");
$I->sendSoapRequest('readItem', ['id' => $this->id]);
$I->dontSeeSoapResponseIncludes("<name>{$this->name}</name>");
}
示例2: invalidTime
public function invalidTime(ApiTester $I)
{
$I->am('an invalid device');
$I->wantTo('verify the endpoint returns validation failures - invalid time');
//Send a bad code to the endpoint
$I->haveHttpHeader('Content-Type', 'application/json');
$I->haveHttpHeader('Accept', 'application/json');
$I->sendPOST('/acs', ['device' => 'main-door', 'tag' => 'ABCDEF123456', 'message' => 'boot', 'service' => 'entry', 'time' => 'abcdefgh']);
$I->canSeeResponseCodeIs(422);
}
示例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"');
}
示例4: 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']));
}
示例5: testTestUsersCreation
public function testTestUsersCreation(ApiTester $I)
{
$I->wantTo('make sure my test users have been created');
$I->amHttpAuthenticated('admin', 'admin');
$I->sendGET($this->baseUrl . '/users/' . $this->userId);
$I->seeResponseCodeIs(200);
$I->seeResponseIsXml();
$I->seeXmlResponseIncludes(XmlUtils::toXml(['status' => 'ok']));
$I->sendGET($this->baseUrl . '/users/' . $this->sharerUserId);
$I->seeResponseCodeIs(200);
$I->seeResponseIsXml();
$I->seeXmlResponseIncludes(XmlUtils::toXml(['status' => 'ok']));
}
示例6: 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]);
}
示例7: successfullEnd
public function successfullEnd(ApiTester $I)
{
$I->am('a valid user');
$I->wantTo('verify the endpoint returns a success response and creates the proper records');
$user = $I->getActiveKeyholderMember();
$keyFob = $I->getMemberKeyFob($user->id);
//Send a bad code to the endpoint
$I->sendPOST('/access-control/device', ['data' => $keyFob->key_id . '|welder|start']);
//The device endpoint always returns 200
$I->canSeeResponseCodeIs(200);
//Make sure a success is returned and a session started
$I->canSeeResponseContainsJson(['valid' => '1']);
$I->seeInDatabase('equipment_log', ['user_id' => $user->id, 'device' => 'welder', 'active' => 1]);
$I->sendPOST('/access-control/device', ['data' => $keyFob->key_id . '|welder|end']);
$I->canSeeResponseCodeIs(200);
$I->dontSeeHttpHeader('Set-Cookie');
$I->dontSeeHttpHeader('Built-By');
$I->canSeeResponseContainsJson(['valid' => '1']);
//Make sure our database record is not active
$I->seeInDatabase('equipment_log', ['user_id' => $user->id, 'device' => 'welder', 'active' => 0]);
//And make sure there is no other active record
$I->cantSeeInDatabase('equipment_log', ['user_id' => $user->id, 'device' => 'welder', 'active' => 1]);
}
示例8: ApiTester
<?php
$scenario->group('rels');
$I = new ApiTester($scenario);
$I->wantTo('load the initial rels');
$I->sendGET('/rels');
$I->grabDataFromResponseByJsonPath('$');
$I->seeResponseContainsJson(['loadList' => '/list/elements', 'addToList' => '/list/elements', 'removeFromList' => '/list/elements']);
示例9: ApiTester
<?php
$I = new ApiTester($scenario);
$I->wantTo('Insert items and checkout');
/**
* @var array $item1
* @var array $item2
* @var int $order
*/
require "_AddItems.php";
$I->amGoingTo('checkout');
$I->sendPATCH('cart');
$I->seeCodeAndJson(200, ['id' => $order, 'total' => floatify($item1['final_price'] + $item2['final_price'])]);
$I->amGoingTo('verify the order was really ~closed~');
$I->sendGET('cart');
$I->assertEquals(sizeof(json_decode($I->grabResponse())->items), 0, 'verify the cart is now empty');
示例10: ApiTester
<?php
$I = new ApiTester($scenario);
$I->wantTo('perform actions and see result');
示例11: ApiTester
<?php
$I = new ApiTester($scenario);
$I->wantTo('adicionar um novo pedido');
$I->amHttpAuthenticated('phptesting', '123');
$I->sendPOST('/pedido', ['produtoid' => 1, 'produtonome' => 'Firefox', 'produtoestoque' => 10, 'produtovalor' => 49.9]);
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContainsJson(['status' => 'sucesso', 'message' => 'Sucesso']);
示例12: ApiTester
<?php
$I = new ApiTester($scenario);
$I->wantTo('Get friends list');
$I->haveHttpHeader('Content-Type', 'application/json');
$I->sendGET('/users/14/friends', array());
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
示例13: ApiTester
<?php
$I = new ApiTester($scenario);
$I->wantTo('Get user with not exists id');
$I->sendGET('users/500000000');
$I->seeResponseCodeIs(404);
$I->seeResponseIsJson();
$I->haveHttpHeader('Content-Type', 'application/json');
示例14: ApiTester
<?php
$I = new ApiTester($scenario);
$I->wantTo('Check for hot tips');
//$I->amHttpAuthenticated('service_user', '123456');
////$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
$I->sendGet('http://api.invendium-dev.com/?source=');
//$I->seeResponseCodeIs(200);
//$I->seeResponseIsJson();
//$I->seeResponseContains('odds_rounded');
//$I->seeResponseContains('popularity');
//$I->seeResponseContainsJson(array('sport' => 'Football'));
$tips = $I->grabDataFromResponseByJsonPath('$.tips');
$array = array();
foreach ($tips[0] as $tip) {
$array[] = $tip['sportname'];
}
$array = array_count_values($array);
foreach ($array as $sportname => $tipsCount) {
$I->assertGreaterThanOrEqual('10', $tipsCount, "{$sportname} has only {$tipsCount} tips.");
}
示例15: missingRateError
/**
* @param \ApiTester $I
*/
public function missingRateError(ApiTester $I)
{
$I->wantTo('Error while saving: missing rate.');
$I->sendPost('http://currencyfairtest.com/api/messages', ["userId" => "100", "currencyFrom" => "EUR", "amountSell" => "999.0000", "timePlaced" => "31-AUG-15 22:00:00"]);
$I->seeResponseCodeIs(400);
$I->seeResponseIsJson();
$I->seeResponseContains('ERROR');
$I->seeResponseContains('rate');
$I->seeResponseContains('The rate field is required.');
}