本文整理汇总了PHP中ApiTester::createTable方法的典型用法代码示例。如果您正苦于以下问题:PHP ApiTester::createTable方法的具体用法?PHP ApiTester::createTable怎么用?PHP ApiTester::createTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApiTester
的用法示例。
在下文中一共展示了ApiTester::createTable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete(ApiTester $I)
{
$user = $I->createAndLoginUser();
$I->createProjectAndSetHeader();
$I->loginClient($I->getCurrentClient());
$second_user = $I->createUser(true);
$I->loginUser($user);
$table = $I->createTable();
$I->sendPOST('api/v1/projects/users', ['user_id' => $second_user->_id, 'role' => 'manager', 'scope' => ['tables_view', 'tables_update']]);
$I->loginUser($second_user);
$I->sendDELETE('api/v1/projects');
$I->seeResponseCodeIs(403);
$I->loginUser($user);
$I->sendDELETE('api/v1/projects');
$I->seeResponseCodeIs(200);
$I->sendGET('api/v1/admin/tables' . $table->_id);
$I->seeResponseCodeIs(404);
}
示例2: variantsProbabilityPercent
public function variantsProbabilityPercent(ApiTester $I)
{
$I->createAndLoginUser();
$I->createProjectAndSetHeader();
$data = $I->getTableShortData();
$data['variants_probability'] = 'percent';
$data['variants'][0]['probability'] = 10;
$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' => 40, 'rules' => $I->getVariantRules()];
$data['variants'][2] = ['title' => 'Variant 3', 'default_title' => 'Variant 3', 'default_description' => 'Description Variant 3', 'default_decision' => 'Decline', 'probability' => 50, 'rules' => $I->getVariantRules()];
$matched = [];
$table = $I->createTable($data);
for ($i = 0; $i < 100; $i++) {
$res = $I->makeDecision($table->_id, ['numeric' => 340, 'string' => 'Bad', 'bool' => true]);
$title = $res->table->variant->title;
if (!array_key_exists($title, $matched)) {
$matched[$title] = 0;
}
$matched[$title]++;
}
$I->assertEquals(3, count($matched), 'Some Table.variants for variants_probability=percent not matched');
$I->assertTrue($matched['Variant 1'] < $matched['Variant 2'], 'Variant 1 checked more than Variant 2');
$I->assertTrue($matched['Variant 1'] < $matched['Variant 3'], 'Variant 1 checked more than Variant 3');
}
示例3: accessForCheck
public function accessForCheck(ApiTester $I)
{
$first_user = $I->createUser(true, '', false);
$second_user = $I->createUser(true);
$I->loginUser($first_user);
$I->createProjectAndSetHeader();
$consumer = $I->createConsumer();
$table = $I->createTable();
$table_id = $table->_id;
$data = ['borrowers_phone_verification' => 'Positive', 'contact_person_phone_verification' => 'Positive', 'internal_credit_history' => 'Positive', 'employment' => true, 'property' => true, 'matching_rules_type' => 'decision'];
$I->sendPOST("api/v1/tables/{$table_id}/decisions", $data);
$I->canSeeResponseCodeIs(403);
$I->seeResponseContains("Project owner is not activated, try again later");
$I->sendPOST('api/v1/projects/users', ['user_id' => $second_user->_id, 'role' => 'manager', 'scope' => ['tables_view', 'decisions_make']]);
$I->loginUser($second_user);
$I->sendPOST("api/v1/tables/{$table_id}/decisions", $data);
$I->canSeeResponseCodeIs(403);
$I->seeResponseContains("Project owner is not activated, try again later");
$I->loginConsumer($consumer);
$I->sendPOST("api/v1/tables/{$table_id}/decisions", $data);
$I->canSeeResponseCodeIs(403);
$I->seeResponseContains("Project owner is not activated, try again later");
$I->logout();
$I->loginClient($I->getCurrentClient());
$I->sendPOST('api/v1/users/verify/email', ['token' => $first_user->sandbox->token_email->token]);
$I->seeResponseCodeIs(200);
$I->loginUser($first_user);
$I->makeDecision($table_id);
$I->loginConsumer($consumer);
$I->makeDecision($table_id);
$I->loginUser($second_user);
$I->makeDecision($table_id);
}
示例4: hideMeta
public function hideMeta(ApiTester $I)
{
$I->createAndLoginUser();
$I->createProjectAndSetHeader(['settings' => ['show_meta' => false]]);
$I->createTable();
$I->makeDecision($I->getResponseFields()->data->_id, [], 'decision', false);
}