本文整理汇总了PHP中ApiTester::canSeeResponseJsonMatchesJsonPath方法的典型用法代码示例。如果您正苦于以下问题:PHP ApiTester::canSeeResponseJsonMatchesJsonPath方法的具体用法?PHP ApiTester::canSeeResponseJsonMatchesJsonPath怎么用?PHP ApiTester::canSeeResponseJsonMatchesJsonPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApiTester
的用法示例。
在下文中一共展示了ApiTester::canSeeResponseJsonMatchesJsonPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateMetaInvalid
public function updateMetaInvalid(ApiTester $I)
{
$I->createAndLoginUser();
$I->createProjectAndSetHeader();
$I->createTable($I->getTableShortData());
$decision = $I->makeDecision($I->getResponseFields()->data->_id, ['bool' => true, 'numeric' => 123, 'string' => 'Yes']);
$data = array_fill(0, 20, 'test');
$data[str_repeat('2', 101)] = 'ok';
$data['invalid#'] = 'ok';
$data['stringLength'] = str_repeat('1', 501);
$data['array'] = [];
$data[] = [['array']];
$I->sendPUT("api/v1/admin/decisions/{$decision->_id}/meta", ['meta' => $data]);
$I->seeResponseCodeIs(422);
$I->canSeeResponseJsonMatchesJsonPath('$.data.meta_keys_amount');
$I->canSeeResponseJsonMatchesJsonPath('$.data.key_20');
$I->canSeeResponseJsonMatchesJsonPath('$.data.key_21');
$I->canSeeResponseJsonMatchesJsonPath('$.data.key_22_value');
$I->canSeeResponseJsonMatchesJsonPath('$.data.key_23_value');
$I->canSeeResponseJsonMatchesJsonPath('$.data.key_24_value');
$I->sendPUT("api/v1/admin/decisions/{$decision->_id}/meta", $data);
$I->seeResponseCodeIs(422);
$I->canSeeResponseJsonMatchesJsonPath('$.data.meta');
$I->sendPUT("api/v1/admin/decisions/{$decision->_id}/meta", []);
$I->seeResponseCodeIs(422);
$I->canSeeResponseJsonMatchesJsonPath('$.data.meta');
}
示例2: ApiTester
<?php
use Codeception\Module\ApiHelper;
$testPostData = ['title' => 'This is a cool topic!', 'details' => 'Where is the seismic moon? Ships meet on mankind at atlantis tower! Transporter of a ' . 'sub-light energy, arrest the voyage! Why does the planet meet? Planets die from ' . 'voyages like ship-wide space suits.', 'excerpt' => 'Yuck! Pieces o\' life are forever swashbuckling. Madness ho! scrape to be commanded.', 'owned_by_creator' => true];
$I = new ApiTester($scenario);
$I->wantTo('create a topic for me to talk about');
// Headers
$I->haveHttpHeader('Content-Type', 'application/json');
// Submit
$I->sendPOST(ApiHelper::ENDPOINT_TOPICS, $testPostData);
// Response
$I->seeResponseCodeIs(201);
$I->seeResponseIsJson();
$I->canSeeResponseJsonMatchesJsonPath('$.id');
$I->assertEquals($testPostData['details'], $I->grabDataFromResponseByJsonPath('$.details')[0]);
$I->assertEquals($testPostData['excerpt'], $I->grabDataFromResponseByJsonPath('$.excerpt')[0]);
$I->assertEquals($testPostData['owned_by_creator'], $I->grabDataFromResponseByJsonPath('$.owned_by_creator')[0]);
$I->canSeeResponseJsonMatchesJsonPath('$.created_at');
// Db record
$I->seeInDatabase('topic', $testPostData);