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


PHP ApiTester::seeResponseMatchesJsonType方法代码示例

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


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

示例1: export

 public function export(ApiTester $I)
 {
     $I->createAndLoginUser();
     $I->createProjectAndSetHeader();
     $I->createTable();
     $I->sendGET('api/v1/projects/export');
     $I->seeResponseCodeIs(200);
     $I->seeResponseMatchesJsonType(['url' => 'string'], '$.data');
     $I->assertTrue(false !== file_get_contents($I->getResponseFields()->data->url));
 }
开发者ID:Nebo15,项目名称:gandalf.api,代码行数:10,代码来源:ProjectsCest.php

示例2: obtainAuthCodeGrant

 function obtainAuthCodeGrant(ApiTester $I)
 {
     $user = factory(App\Models\User::class, 1)->create();
     $user->password = 'password';
     $user->save();
     $I->amLoggedAs($user);
     $client = factory(App\Models\OAuthClient::class, 1)->create();
     $grant = \App\Models\OAuthGrant::find('authorization_code');
     $client->oauth_grants()->attach($grant);
     $scope = \App\Models\OAuthScope::find('user_read');
     $client->oauth_scopes()->attach($scope);
     $endpoint = factory(App\Models\OAuthClientEndpoint::class, 1)->make();
     $endpoint->oauth_client()->associate($client);
     $endpoint->save();
     $I->wantTo('Perform a full 3rd party authorisation flow and get an access token');
     $I->amOnPage('authorize?client_id=' . $client->id . '&redirect_uri=' . $endpoint->redirect_uri . '&response_type=code&scope=user_read');
     $I->click('approve');
     $I->seeInCurrentUrl('code=');
     $url = Request::fullUrl();
     $parts = parse_url($url);
     parse_str($parts['query'], $query);
     $code = $query['code'];
     $I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
     $I->sendPOST('oauth/access_token', ['grant_type' => 'authorization_code', 'client_id' => $client->id, 'client_secret' => $client->secret, 'redirect_uri' => $endpoint->redirect_uri, 'code' => $code]);
     $I->seeResponseCodeIs(200);
     $I->seeResponseIsJson();
     $I->seeResponseMatchesJsonType(['access_token' => 'string']);
 }
开发者ID:slice-beans,项目名称:cqs-framework,代码行数:28,代码来源:AuthenticationCest.php

示例3: createInvalid

 public function createInvalid(ApiTester $I)
 {
     $I->createAndLoginUser();
     $I->createProjectAndSetHeader();
     $table_id = $I->createTable()->_id;
     $I->sendPOST("api/v1/tables/{$table_id}/decisions", ['internal_credit_history' => 'okay']);
     $I->seeResponseCodeIs(422);
     $I->seeResponseMatchesJsonType(['borrowers_phone_verification' => 'array', 'contact_person_phone_verification' => 'array', 'property' => 'array', 'employment' => 'array'], '$.data');
     $I->sendPOST("api/v1/tables/{$table_id}/decisions", ['internal_credit_history' => 'okay', 'borrowers_phone_verification' => 'okay', 'contact_person_phone_verification' => 'okay', 'property' => 'okay', 'employment' => 'okay']);
     $I->seeResponseCodeIs(422);
     $I->seeResponseMatchesJsonType(['property' => 'array', 'employment' => 'array'], '$.data');
 }
开发者ID:Nebo15,项目名称:gandalf.api,代码行数:12,代码来源:DecisionsCest.php

示例4: ApiTester

<?php

/** @var AcceptanceTester $I */
$I = new ApiTester($scenario);
$I->wantTo('get list of frameworks');
$I->sendGET('/api/frameworks');
$I->seeResponseCodeIs(200);
$I->dontSeeResponseCodeIs(500);
$I->canSeeHttpHeader('Content-Type', 'application/json');
$I->seeResponseIsJson();
$I->seeResponseContainsJson(['name' => 'Phalcon', 'version' => '2.0.8']);
$I->seeResponseMatchesJsonType(['name' => 'string', 'version' => 'string:regex(~\\d\\.\\d\\.\\d~)']);
开发者ID:Zifius,项目名称:phalcon-api-meetup,代码行数:12,代码来源:GetFrameworksCept.php

示例5: ApiTester

<?php

Yii::$app->redis->executeCommand('FLUSHDB');
use Codeception\Util\Debug;
$model = new \app\models\Message();
$model->author_email = 'test@gmail.com';
$model->author_name = 'test';
$model->message = str_repeat('A', 140);
$model->save();
$I = new ApiTester($scenario);
$I->wantTo('Ver uma mensagem');
$I->sendGET('messages/' . $model->id);
$I->seeResponseIsJson();
$I->seeResponseMatchesJsonType(['id' => 'string', 'author_name' => 'string', 'author_email' => 'string:email', 'creation_time' => 'string', 'message' => 'string']);
开发者ID:jsopra,项目名称:lepetitmessager,代码行数:14,代码来源:ViewCept.php


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