本文整理汇总了PHP中ApiTester::getTableShortData方法的典型用法代码示例。如果您正苦于以下问题:PHP ApiTester::getTableShortData方法的具体用法?PHP ApiTester::getTableShortData怎么用?PHP ApiTester::getTableShortData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApiTester
的用法示例。
在下文中一共展示了ApiTester::getTableShortData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: variantsProbabilityInvalid
public function variantsProbabilityInvalid(ApiTester $I)
{
$I->createAndLoginUser();
$I->createProjectAndSetHeader();
# invalid variants_probability
$data = $I->getTableShortData();
$data['variants_probability'] = 'invalid';
$I->sendPOST('api/v1/admin/tables', $data);
$I->seeResponseCodeIs(422);
$I->seeResponseContains('variants_probability');
# more than 100
$data['variants_probability'] = 'percent';
$data['variants'][0]['probability'] = 30;
$data['variants'][0]['title'] = 'Variant 1';
$data['variants'][1] = ['title' => 'Variant 2', 'default_title' => 'Variant 2', 'default_description' => 'Description Variant 2', 'default_decision' => 'Decline', 'probability' => 71, 'rules' => $I->getVariantRules()];
$I->sendPOST('api/v1/admin/tables', $data);
$I->seeResponseCodeIs(422);
$I->seeResponseContains('variants_probability');
# less than 100
$data['variants'][0]['probability'] = 28;
$I->sendPOST('api/v1/admin/tables', $data);
$I->seeResponseCodeIs(422);
$I->seeResponseContains('variants_probability');
}
示例2: 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');
}