本文整理汇总了PHP中ApiTester::seeResponseJsonMatchesJsonPath方法的典型用法代码示例。如果您正苦于以下问题:PHP ApiTester::seeResponseJsonMatchesJsonPath方法的具体用法?PHP ApiTester::seeResponseJsonMatchesJsonPath怎么用?PHP ApiTester::seeResponseJsonMatchesJsonPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApiTester
的用法示例。
在下文中一共展示了ApiTester::seeResponseJsonMatchesJsonPath方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkGenericLoginData
private function checkGenericLoginData()
{
$this->tester->seeResponseJsonMatchesJsonPath('$.status');
$this->tester->seeResponseJsonMatchesJsonPath('$.data.username');
$this->tester->seeResponseJsonMatchesJsonPath('$.data.email');
$this->tester->seeResponseJsonMatchesJsonPath('$.data.registrationId');
}
示例2: checkStatList
private function checkStatList()
{
$this->tester->seeResponseCodeIs(200);
$this->tester->seeResponseIsJson();
$data = json_decode($this->tester->grabResponse(), true);
$this->tester->seeResponseJsonMatchesJsonPath('$.status');
$this->tester->seeResponseJsonMatchesJsonPath('$.data');
foreach ($data['data']['stats'] as $item) {
$this->assertArrayHasKey('team', $item);
$this->assertArrayHasKey('player', $item);
$this->assertArrayHasKey('id', $item['player']);
$this->assertArrayHasKey('alias', $item['player']);
$this->assertArrayHasKey('level', $item['player']);
$this->assertArrayHasKey('isLive', $item['player']);
$this->assertArrayHasKey('isLive', $item);
$this->assertArrayHasKey('location', $item);
$this->assertArrayHasKey('player', $item['location']);
$this->assertArrayHasKey('lat', $item['location']);
$this->assertArrayHasKey('lng', $item['location']);
$this->assertArrayHasKey('game', $item['location']);
}
}
示例3: checkLocationList
private function checkLocationList()
{
$this->tester->seeResponseCodeIs(200);
$this->tester->seeResponseIsJson();
$this->tester->seeResponseJsonMatchesJsonPath('$.status');
$this->tester->seeResponseJsonMatchesJsonPath('$.data');
$this->tester->seeResponseJsonMatchesJsonPath('$.data[0].lat');
$this->tester->seeResponseJsonMatchesJsonPath('$.data[0].lng');
$this->tester->seeResponseJsonMatchesJsonPath('$.data[0].game');
}
示例4: 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('Ver a lista de mensagens');
$I->sendGET('messages', []);
$I->seeResponseIsJson();
$I->seeResponseJsonMatchesJsonPath('$[0].author_name');
$I->seeResponseJsonMatchesJsonPath('$[0].author_email');
$I->seeResponseJsonMatchesJsonPath('$[0].message');
$I->seeResponseJsonMatchesJsonPath('$[0].id');
$I->seeResponseJsonMatchesJsonPath('$[0].creation_time');
示例5: ApiTester
<?php
$I = new ApiTester($scenario);
$I->wantTo('log in as an anonymous user');
$I->sendPOST('users/login');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseJsonMatchesJsonPath('$.skey');
$I->seeResponseJsonMatchesJsonPath('$.userid');
$I->seeResponseJsonMatchesJsonPath('$.email');
$guidResponse = $I->getRequestJSON();
$I->wantTo('log in as an anonymous user using a previous GUID');
$I->sendPOST('users/login', ['username' => $guidResponse['email']]);
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContainsJSON(['email' => $guidResponse['email']]);
$I->seeResponseContainsJSON(['userid' => $guidResponse['userid']]);
$I->wantTo('fail to log in with an unregistered CCID');
$I->sendPOST('users/login', ['username' => '@12345678']);
$I->seeResponseCodeIs(401);
$I->wantTo('fail to log in with an incorrect CCID password');
$I->sendPOST('users/login', ['username' => 'rob@creativecommons.org', 'password' => 'obviouslybadpassword']);
$I->seeResponseCodeIs(401);
示例6: ApiTester
<?php
$I = new ApiTester($scenario);
$I->wantTo('get a list of all cards');
$I->amHttpAuthenticated('test_api', '123456');
$I->haveHttpHeader('Content-Type', 'application/json');
$I->sendGET('/cards');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseJsonMatchesJsonPath('$[0].result');
示例7: 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);
示例8: ApiTester
<?php
$I = new ApiTester($scenario);
$I->wantTo('validate that test route works properly');
$I->sendGET('/test');
$I->seeResponseIsJson();
$I->seeResponseJsonMatchesJsonPath('$.message');
示例9: ApiTester
<?php
$I = new ApiTester($scenario);
$I->wantTo('list the most recent photos in the feed');
$I->sendGET('photos');
$I->seeResponseCodeIs(200);
//TODO: Check for reasonable values
$I->seeResponseJsonMatchesJsonPath('$.next_id');
$I->seeResponseJsonMatchesJsonPath('$.from_id');
$I->seeResponseJsonMatchesJsonPath('$.count');
//TODO: check for Creative Commons values
$I->seeResponseJsonMatchesJsonPath('$photos[*].itemid');
$I->seeResponseJsonMatchesJsonPath('$photos[*].url');
$I->seeResponseJsonMatchesJsonPath('$photos[*].title');
$I->seeResponseJsonMatchesJsonPath('$photos[*].description');
$I->seeResponseJsonMatchesJsonPath('$photos[*].category');
$I->seeResponseJsonMatchesJsonPath('$photos[*].approved');
$I->seeResponseJsonMatchesJsonPath('$photos[*].username');
$I->seeResponseJsonMatchesJsonPath('$photos[*].userid');
$I->seeResponseJsonMatchesJsonPath('$photos[*].makerid');
$I->seeResponseJsonMatchesJsonPath('$photos[*].makername');
示例10: ApiTester
<?php
$I = new ApiTester($scenario);
$I->wantTo('get the list of latest items from the master list');
$I->sendGET('items');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
//TODO: ensure count is 20
// The responses are random, so we cannot check specific id/title/etc. values
//TODO: check for Creative Commons values
$I->seeResponseJsonMatchesJsonPath('$[*].id');
$I->seeResponseJsonMatchesJsonPath('$[*].makerid');
$I->seeResponseJsonMatchesJsonPath('$[*].title');
$I->seeResponseJsonMatchesJsonPath('$[*].description');
$I->seeResponseJsonMatchesJsonPath('$[*].uri');
$I->seeResponseJsonMatchesJsonPath('$[*].approved');
$I->seeResponseJsonMatchesJsonPath('$[*].category');
$I->seeResponseJsonMatchesJsonPath('$[*].name');