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


PHP ApiTester::logout方法代码示例

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


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

示例1: readList

 public function readList(ApiTester $I)
 {
     $I->createAndLoginUser();
     $I->createProjectAndSetHeader();
     $tableData = $I->getTableShortData();
     $tableData['title'] = 'Search';
     $tableData['description'] = 'Concrete';
     $table1 = $I->createTable($tableData);
     $tableData['title'] = 'Search';
     $tableData['description'] = 'Another';
     $table2 = $I->createTable($tableData);
     $tableData['title'] = 'caps';
     $tableData['description'] = 'EXAMPLE';
     $table3 = $I->createTable($tableData);
     $tableData['title'] = 'mank@34ind';
     $tableData['description'] = 'example';
     $table4 = $I->createTable($tableData);
     $I->sendGET('api/v1/admin/tables');
     $I->assertListTable();
     foreach ($I->getResponseFields()->data as $item) {
         $I->sendGET('api/v1/admin/tables/' . $item->_id);
         $I->assertTable();
     }
     $queries = ['title=arc' => ['amount' => 2, 'ids' => [$table1->_id, $table2->_id]], 'title=@34' => ['amount' => 1, 'ids' => [$table4->_id]], 'description=EXA' => ['amount' => 2, 'ids' => [$table3->_id, $table4->_id]]];
     foreach ($queries as $query => $data) {
         $I->sendGET("api/v1/admin/tables?{$query}");
         $I->assertListTable();
         $response = $I->getResponseFields()->data;
         $I->assertEquals($data['amount'], count($response), "Wrong amount of the tables for query {$query}");
         for ($i = 0; $i < count($response); ++$i) {
             $id = $response[$i]->_id;
             $I->assertTrue(in_array($id, $data['ids']), "Id '{$id}' should not be in response for query {$query}");
             unset($data['ids'][$i]);
         }
         $I->assertTrue(0 == count($data['ids']), "Next ids should be in response: " . implode(',', $data['ids']) . ". Query: {$query}");
     }
     $I->logout();
     $I->sendGET('api/v1/admin/tables');
     $I->seeResponseCodeIs(401);
 }
开发者ID:Nebo15,项目名称:gandalf.api,代码行数:40,代码来源:TablesCest.php

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


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