本文整理汇总了PHP中AcceptanceTester::seeResponseJsonMatchesJsonPath方法的典型用法代码示例。如果您正苦于以下问题:PHP AcceptanceTester::seeResponseJsonMatchesJsonPath方法的具体用法?PHP AcceptanceTester::seeResponseJsonMatchesJsonPath怎么用?PHP AcceptanceTester::seeResponseJsonMatchesJsonPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AcceptanceTester
的用法示例。
在下文中一共展示了AcceptanceTester::seeResponseJsonMatchesJsonPath方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: AcceptanceTester
<?php
$I = new AcceptanceTester($scenario);
$I->wantTo('test various search examples');
// simple search of child table
$I->sendGet('/attendees?page=1&per_page=5');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseJsonMatchesJsonPath('$.attendees[*].id');
// complex search on child table
$I->sendGet('/attendees?page=1&per_page=5');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseJsonMatchesJsonPath('$.attendees[*].id');
// simple search of complex table
$I->sendGet('/events?page=1&per_page=5');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseJsonMatchesJsonPath('$.events[*].id');
// test with syntax
$I->sendGet('/events?page=1&per_page=5&with=cabins,locations,programs,sessions');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseJsonMatchesJsonPath('$.events[*].id');
$I->seeResponseJsonMatchesJsonPath('$.locations[*].id');
$I->seeResponseJsonMatchesJsonPath('$.programs[*].id');
$I->seeResponseJsonMatchesJsonPath('$.cabins[*].id');
$I->seeResponseJsonMatchesJsonPath('$.sessions[*].id');
// test with + single individual syntax
$I->sendGet('/events/1?page=1&per_page=5&with=cabins,locations,programs,sessions');
$I->seeResponseCodeIs(200);
示例2: AcceptanceTester
<?php
$I = new AcceptanceTester($scenario);
$I->wantTo('test basic User operations');
// load a subsect of users
$I->wantTo('load a group of users');
$I->sendGet('/users?page=1&per_page=5');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseJsonMatchesJsonPath('$.users[*].first_name');
示例3: AcceptanceTester
<?php
$I = new AcceptanceTester($scenario);
$I->wantTo('test basic Account operations');
// load a subsect of accounts
$I->wantTo('load a group of accounts');
$I->sendGet('/accounts?page=1&per_page=5');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseJsonMatchesJsonPath('$.accounts[*].created_on');
示例4: AcceptanceTester
<?php
$I = new AcceptanceTester($scenario);
$I->wantTo('test basic Location operations');
// load a subsect of locations
$I->wantTo('load a group of locations');
$I->sendGet('/locations?page=1&per_page=5');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseJsonMatchesJsonPath('$.locations[*].name');
示例5: AcceptanceTester
<?php
$I = new AcceptanceTester($scenario);
$I->wantTo('test basic Program operations');
// load a subsect of programs
$I->wantTo('load a group of programs');
$I->sendGet('/programs?page=1&per_page=5');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseJsonMatchesJsonPath('$.programs[*].name');
示例6: AcceptanceTester
<?php
$I = new AcceptanceTester($scenario);
$I->wantTo('Test query abilities of all api end points');
$endpoints = array('addresses', 'customers', 'users');
foreach ($endpoints as $endpoint) {
$I->sendGet("{$endpoint}?limit=2");
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$newID = $I->grabDataFromResponseByJsonPath("\$.{$endpoint}[0].id");
// test calling an individual resource
$I->sendGet($endpoint . '/' . $newID[0]);
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
// test offsett
$I->sendGet("{$endpoint}?limit=2&offset=2");
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseJsonMatchesJsonPath("\$.{$endpoint}[*].id");
// run searches side loading all records
$I->sendGet("{$endpoint}?limit=2&offset=2&with=all");
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseJsonMatchesJsonPath("\$.{$endpoint}[*].id");
// run searches with NO side loaded records
$I->sendGet("{$endpoint}?limit=2&offset=2&with=none");
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseJsonMatchesJsonPath("\$.{$endpoint}[*].id");
}