當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。