当前位置: 首页>>代码示例>>PHP>>正文


PHP ApiTester::getResponseFields方法代码示例

本文整理汇总了PHP中ApiTester::getResponseFields方法的典型用法代码示例。如果您正苦于以下问题:PHP ApiTester::getResponseFields方法的具体用法?PHP ApiTester::getResponseFields怎么用?PHP ApiTester::getResponseFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ApiTester的用法示例。


在下文中一共展示了ApiTester::getResponseFields方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: decisionType

 public function decisionType(ApiTester $I)
 {
     $I->createAndLoginUser();
     $I->createProjectAndSetHeader();
     # alpha_num
     $tableData = $I->getTableShortData();
     $tableData['decision_type'] = 'alpha_num';
     $I->createTable($tableData);
     # numeric invalid
     $tableData['decision_type'] = 'numeric';
     $tableData['variants'][0]['than'] = 'string';
     $tableData['variants'][0]['default_decision'] = 'string';
     $I->sendPOST('api/v1/admin/tables', $tableData);
     $I->seeResponseCodeIs(422);
     $response = $I->getResponseFields()->data;
     $I->assertTrue(array_key_exists('variants.0.default_decision', $response));
     $I->assertTrue(array_key_exists('variants.0.rules.0.than', $response));
     $I->assertTrue(array_key_exists('variants.0.rules.1.than', $response));
     # numeric valid
     $tableData['variants'][0]['default_decision'] = 1;
     $tableData['variants'][0]['rules'][0]['than'] = -202;
     $tableData['variants'][0]['rules'][1]['than'] = 123.34;
     $I->createTable($tableData);
     # json
     $tableData = $I->getTableShortData();
     $tableData['decision_type'] = 'json';
     $tableData['variants'][0]['default_decision'] = '{}';
     $tableData['variants'][0]['rules'][0]['than'] = '{"ok":true}';
     $tableData['variants'][0]['rules'][1]['than'] = '[123,456]';
     $I->createTable($tableData);
     # invalid json
     $tableData['variants'][0]['rules'][1]['than'] = '{invalid json}';
     $I->sendPOST('api/v1/admin/tables', $tableData);
     $I->seeResponseCodeIs(422);
     $response = $I->getResponseFields()->data;
     $I->assertTrue(array_key_exists('variants.0.rules.1.than', $response));
     # for scoring decision_type is always numeric
     $tableData = $I->getShortTableDataMatchingTypeAll();
     $tableData['decision_type'] = 'json';
     $I->sendPOST('api/v1/admin/tables', $tableData);
     $I->seeResponseCodeIs(422);
     $I->seeResponseContains('decision_type');
 }
开发者ID:Nebo15,项目名称:gandalf.api,代码行数:43,代码来源:TablesCest.php

示例2: find

 public function find(ApiTester $I, $scenario)
 {
     $usersList = [$I->createUser(true), $I->createUser(true), $I->createUser(true), $I->createUser(true)];
     $user = $I->createAndLoginUser();
     $I->sendGET('api/v1/users');
     $I->sendGET('api/v1/users?name=' . substr($usersList[0]->username, 0, 3));
     $foundUsers = json_encode($I->getResponseFields()->data);
     $I->assertContains($usersList[0]->username, $foundUsers);
     $I->assertContains($usersList[0]->_id, $foundUsers);
     list($email) = explode('@', $usersList[1]->temporary_email);
     $I->sendGET('api/v1/users?name=' . $email . '@');
     $foundUsers = json_encode($I->getResponseFields()->data);
     $I->assertContains($usersList[1]->username, $foundUsers);
     $I->assertContains($usersList[1]->_id, $foundUsers);
     $I->sendGET('api/v1/users?name=' . substr($user->username, 0, 3));
     $foundUsers = json_encode($I->getResponseFields()->data);
     $I->assertNotContains($user->username, $foundUsers);
     $I->assertNotContains($user->_id, $foundUsers);
     $I->loginUser($usersList[0]);
     $I->sendGET('api/v1/users?name=' . substr($user->username, 0, 3));
     $foundUsers = json_encode($I->getResponseFields()->data);
     $I->assertContains($user->username, $foundUsers);
     $I->assertContains($user->_id, $foundUsers);
 }
开发者ID:Nebo15,项目名称:gandalf.api,代码行数:24,代码来源:UsersCest.php

示例3: settings

 public function settings(ApiTester $I)
 {
     $I->createAndLoginUser();
     $I->createProjectAndSetHeader();
     $I->sendPUT('api/v1/projects', ['settings' => []]);
     $I->assertProject();
     $I->assertTrue($I->getResponseFields()->data->settings instanceof \StdClass);
 }
开发者ID:Nebo15,项目名称:gandalf.api,代码行数:8,代码来源:ProjectsCest.php

示例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);
 }
开发者ID:Nebo15,项目名称:gandalf.api,代码行数:7,代码来源:DecisionsCest.php


注:本文中的ApiTester::getResponseFields方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。