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


PHP ApiTester::assertResponseDataFields方法代码示例

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


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

示例1: createUpdateInvalid

 public function createUpdateInvalid(ApiTester $I)
 {
     $I->createAndLoginClient();
     $faker = $I->getFaker();
     /** Normal user for Test Duplicate Username */
     $I->sendPOST('api/v1/users/', ['email' => $faker->email, 'password' => $I->getPassword(), 'username' => 'duplicate', 'active' => true]);
     $I->assertResponseDataFields(['active' => false], 201);
     $invalidData = ['email' => ['', null, 'test', '<script></script>', '"alert12"', "test@i,ua"], 'username' => ['', null, '1', str_repeat('2', 33), 'duplicate'], 'password' => ['', null, '1fa', 'withoutdigit']];
     foreach ($invalidData as $key => $data) {
         $normalUserData = ['email' => $faker->email, 'password' => $I->getPassword(), 'username' => $faker->firstName];
         foreach ($data as $item) {
             $normalUserData[$key] = $item;
             $I->sendPOST('api/v1/users/', $normalUserData);
             $I->seeResponseCodeIs(422);
             $I->seeResponseContains('"error":"validation"');
             $I->seeResponseContains($key);
         }
     }
     $I->createAndLoginUser(true);
     foreach ($invalidData as $key => $data) {
         foreach ($data as $item) {
             $I->sendPUT('api/v1/users/current', [$key => $item]);
             $I->seeResponseCodeIs(422);
             $I->seeResponseContains('"error":"validation"');
             $I->seeResponseContains($key);
         }
     }
     # change password
     $data = [['password' => $I->getPassword()], ['password' => $I->getPassword(), 'current_password' => 'invalid password']];
     foreach ($data as $item) {
         $I->sendPUT('api/v1/users/current', $item);
         $I->seeResponseCodeIs(422);
         $I->seeResponseContains('current_password');
     }
 }
开发者ID:Nebo15,项目名称:gandalf.api,代码行数:35,代码来源:UsersCest.php

示例2: update

 public function update(ApiTester $I)
 {
     $user = $I->createAndLoginUser();
     $I->createProjectAndSetHeader();
     $I->createTable();
     $I->sendGET('api/v1/admin/tables');
     $I->assertListTable();
     $id = $I->getResponseFields()->data[0]->_id;
     $data = $I->getTableData();
     $data['title'] = 'Updated title';
     $data['description'] = 'Updated description';
     $data['fields'] = [["key" => 'test_key', "title" => 'Test key', "source" => "request", "type" => 'string', 'preset' => null]];
     $data['variants'] = [['default_decision' => 'Decline', 'rules' => [['_id' => $I->getMongoId(), 'than' => 'Approve', 'description' => 'New rule', 'conditions' => [['_id' => $I->getMongoId(), 'field_key' => 'test_key', 'condition' => '$eq', 'value' => 'test']]]]]];
     $I->sendPUT('api/v1/admin/tables/' . $id, $data);
     $I->assertTable();
     $I->assertResponseDataFields($data);
     $I->sendGET('api/v1/admin/changelog/tables');
     $I->assertResponseDataFields(['author' => $user->username]);
 }
开发者ID:Nebo15,项目名称:gandalf.api,代码行数:19,代码来源:TablesCest.php

示例3: updateMetaOk

 public function updateMetaOk(ApiTester $I)
 {
     $I->createAndLoginUser();
     $I->createProjectAndSetHeader();
     $I->createTable($I->getTableShortData());
     $decision = $I->makeDecision($I->getResponseFields()->data->_id, ['bool' => true, 'numeric' => 123, 'string' => 'Yes']);
     $data = ['ok' => '0981723qweasdzxcTYUGHJBNBNM!@#$%^&*()_+{}|":>?<~`', 'json' => '{"type":{"num":123}}'];
     $I->sendPUT("api/v1/admin/decisions/{$decision->_id}/meta", ['meta' => $data]);
     $I->assertTableDecisionsForAdmin();
     $I->assertResponseDataFields(['meta' => $data]);
     $data = ['updated' => '0981723qweasdzxcTYUGHJBNBNM!@#$%^&*()_+{}|":>?<~`'];
     $I->sendPUT("api/v1/admin/decisions/{$decision->_id}/meta", ['meta' => $data]);
     $I->assertTableDecisionsForAdmin();
     $I->assertResponseDataFields(['meta' => $data]);
     $I->cantSeeResponseJsonMatchesJsonPath('$.data.meta.ok');
     $I->cantSeeResponseJsonMatchesJsonPath('$.data.meta.json');
 }
开发者ID:Nebo15,项目名称:gandalf.api,代码行数:17,代码来源:DecisionsCest.php


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