本文整理汇总了PHP中ApiTester类的典型用法代码示例。如果您正苦于以下问题:PHP ApiTester类的具体用法?PHP ApiTester怎么用?PHP ApiTester使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ApiTester类的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]);
}
示例2: read
/**
* Preberem zapis
*
* @param ApiTester $I
* @depends create
*/
public function read(\ApiTester $I)
{
$ent = $I->successfullyGet($this->restUrl, $this->obj['id']);
$I->assertEquals($ent['sifra'], 'ZZ');
$I->assertEquals($ent['naziv'], 'uu');
$I->assertEquals($ent['opis'], 'zz');
}
示例3: getMeta
/**
* get meta
*
* @param ApiTester $I
*/
public function getMeta(\ApiTester $I)
{
$controller = "drzava";
$view = "";
$expected = "";
$I->testFormMeta('drzava', '');
}
示例4: readDatum
/**
* Preberem zapis in preverim vsa polja
*
* @depends create
* @param ApiTester $I
*/
public function readDatum(\ApiTester $I)
{
$ent = $I->successfullyGet($this->restUrl, $this->obj3['id']);
codecept_debug($ent);
$I->assertEquals($ent['zacetek'], '2009-09-14T00:00:00+0200');
//konec spremenjen v +0200
$ent = $I->successfullyGet($this->restUrl, $this->obj2['id']);
$I->assertEquals($ent['zacetek'], '2003-02-01T00:00:00+0100');
}
示例5: read
/**
* Preberem zapis in preverim vsa polja
*
* @depends create
* @param ApiTester $I
*/
public function read(\ApiTester $I)
{
$ent = $I->successfullyGet($this->restUrl, $this->obj1['id']);
$I->assertGuid($ent['id']);
$I->assertEquals($ent['oznaka'], 'AA');
$I->assertEquals($ent['naziv'], 'uu');
$I->assertEquals($ent['aktiven'], TRUE);
$I->assertEquals($ent['znacka'], TRUE);
$I->assertEquals($ent['ikona'], 'AA');
}
示例6: 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"');
}
示例7: 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']));
}
示例8: read
/**
* Preberem abonma
*
* @param ApiTester $I
* @depends create
*/
public function read(\ApiTester $I)
{
$ent = $I->successfullyGet($this->restUrl, $this->obj1['id']);
codecept_debug($ent);
$I->assertEquals($ent['stPredstav'], 5);
$I->assertEquals($ent['stKuponov'], 55);
$I->assertEquals($ent['ime'], 'zz');
$I->assertEquals($ent['opis'], 'zz');
$I->assertEquals($ent['kapaciteta'], 444);
$I->assertEquals($ent['barva'], '#123456');
}
示例9: 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>");
}
示例10: 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]);
}
示例11: unknownDeviceSystemMessage
public function unknownDeviceSystemMessage(ApiTester $I)
{
$I->am('sending a valid system message');
$I->wantTo('confirm it is received and handled correctly');
//Post the keyfob to the endpoint
$I->sendPOST('/access-control/main-door', ['data' => ':unknown|unknown']);
//The endpoint always returns 200
$I->seeResponseCodeIs(200);
//Confirm an access log record was created
//$I->seeInDatabase('access_log', ['user_id'=>$user->id, 'key_fob_id'=>$keyFob->id, 'response'=>200, 'service'=>'main-door']);
}
示例12: 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);
}
示例13: read
/**
* Preberem zapis in preverim vsa polja
*
* @depends create
* @param ApiTester $I
*/
public function read(\ApiTester $I)
{
$ent = $I->successfullyGet($this->restUrl, $this->obj1['id']);
codecept_debug($ent);
$I->assertGuid($ent['id']);
$I->assertEquals($ent['name'], 'TESTA');
$I->assertEquals($ent['description'], 'to je A');
$I->assertEquals($ent['builtIn'], false);
//sam določi
}
示例14: read
/**
* Preberem zapis in preverim vsa polja
*
* @depends create
* @param ApiTester $I
*/
public function read(\ApiTester $I)
{
$ent = $I->successfullyGet($this->restUrl, $this->obj1['id']);
$I->assertNotEmpty($ent['id']);
$I->assertEquals($ent['uprizoritev']['id'], $this->lookUprizoritev['id']);
$I->assertEquals($ent['krajGostovanja'], 'zz');
$I->assertEquals($ent['drzavaGostovanja'], $this->objDrzava1['id']);
$I->assertEquals($ent['ustanova'], 'zz');
$I->assertEquals($ent['datumGostovanja'], '2011-02-01T00:00:00+0100');
$I->assertEquals($ent['ponoviInt'], 9);
$I->assertEquals($ent['ponoviKoprInt'], 9);
$I->assertEquals($ent['obiskInt'], 9);
$I->assertEquals($ent['obiskKoprInt'], 9);
$I->assertEquals($ent['zaproseno'], 9.119999999999999, "izračunano zaprošeno");
$I->assertEquals($ent['celotnaVrednost'], 45.6);
$I->assertEquals($ent['nasDelez'], 45.6);
$I->assertEquals($ent['transportniStroski'], 9.119999999999999);
$I->assertEquals($ent['dnevPrvZad'], 9.119999999999999);
$I->assertEquals($ent['tantieme'], 9.119999999999999);
$I->assertEquals($ent['materialni'], 9.119999999999999);
$I->assertEquals($ent['avtorskePravice'], 0);
$I->assertEquals($ent['avtorskiHonorarji'], 9.119999999999999);
$I->assertEquals($ent['avtorskiHonorarjiSamoz'], 9.119999999999999);
$I->assertEquals($ent['vlozekGostitelja'], 2.34);
$I->assertEquals($ent['lastnaSredstva'], $ent['nasDelez'] - $ent['zaproseno'] - $ent['drugiJavni'] - $ent['vlozekGostitelja'], "lastna sredstva");
$I->assertEquals($ent['celotnaVrednostMat'], 0);
// $I->assertEquals($ent['drugiViri'], 9.12);
$I->assertEquals($ent['drugiJavni'], 9.119999999999999);
$I->assertEquals($ent['dokument'], NULL);
$I->assertEquals($ent['gostitelj']['id'], $this->lookPopa1['id']);
$I->assertEquals($ent['sort'], 1);
$I->assertEquals($ent['imaKoprodukcije'], TRUE);
}
示例15: ApiTester
<?php
include 'version.php';
$I = new ApiTester($scenario);
$I->wantTo('fetch the version information for the web app');
$I->sendGET('version');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContainsJson(["api_version" => $api_version, "app_version" => $app_version, "webapp_version" => $webapp_version]);