當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ApiTester::dontSeeResponseContainsJson方法代碼示例

本文整理匯總了PHP中ApiTester::dontSeeResponseContainsJson方法的典型用法代碼示例。如果您正苦於以下問題:PHP ApiTester::dontSeeResponseContainsJson方法的具體用法?PHP ApiTester::dontSeeResponseContainsJson怎麽用?PHP ApiTester::dontSeeResponseContainsJson使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ApiTester的用法示例。


在下文中一共展示了ApiTester::dontSeeResponseContainsJson方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getSinglePost

 public function getSinglePost(ApiTester $I)
 {
     $id = $I->haveRecord('posts', $this->getPostAttributes(['title' => 'Starwars']));
     $I->sendGET($this->endpoint . "/{$id}");
     $I->seeResponseCodeIs(200);
     $I->seeResponseIsJson();
     $I->seeResponseContainsJson(['id' => "{$id}", 'title' => 'Starwars']);
     $I->dontSeeResponseContainsJson([['id' => $id]]);
 }
開發者ID:resulaslan,項目名稱:sample-l4-app,代碼行數:9,代碼來源:PostsResourceCest.php

示例2: ApiTester

<?php

$I = new ApiTester($scenario);
$I->wantTo('get a single device');
$piOne = $I->haveRecord('devices', ['ip' => '192.168.1.101', 'mac' => '11:22:33:44:55:66', 'name' => 'Awesome Pi One', 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
$piTwo = $I->haveRecord('devices', ['ip' => '192.168.1.102', 'mac' => 'AA:BB:CC:DD:EE:FF', 'name' => 'Awesome Pi Two', 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
$I->sendGET('devices/1');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContainsJson(['data' => ['ip' => '192.168.1.101', 'name' => 'Awesome Pi One', 'on_home_page' => 'auto', 'group' => null]]);
$I->seeResponseJsonMatchesXpath('//data//device_added');
$I->seeResponseJsonMatchesXpath('//data//last_contact');
$I->dontSeeResponseContainsJson(['data' => ['ip' => '192.168.1.102', 'name' => 'Awesome Pi Two', 'on_home_page' => 'auto', 'group' => null]]);
$I->sendGET('devices/100');
$I->seeResponseCodeIs(404);
$I->seeResponseIsJson();
$I->seeResponseContainsJson(['errors' => ['title' => 'Did not find the device you are looking for!', 'status' => 404]]);
開發者ID:4mb,項目名稱:pi.strebl.ch,代碼行數:17,代碼來源:GetSingleDeviceCept.php

示例3: ApiTester

<?php

$I = new ApiTester($scenario);
$I->wantTo('list all devices');
$I->haveRecord('devices', ['ip' => '192.168.1.101', 'mac' => '11:22:33:44:55:66', 'name' => 'Public Pi', 'public' => 'true', 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
$piOne = $I->grabRecord('devices', ['ip' => '192.168.1.101']);
$piTwo = $I->haveRecord('devices', ['ip' => '192.168.1.102', 'mac' => 'AA:BB:CC:DD:EE:FF', 'name' => 'Private Pi', 'public' => 'false', 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
$piTwo = $I->grabRecord('devices', ['ip' => '192.168.1.102']);
$piThree = $I->haveRecord('devices', ['ip' => '192.168.1.103', 'mac' => 'AA:11:BB:22:CC:33', 'name' => 'Auto Pi without group', 'public' => 'auto', 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
$piThree = $I->grabRecord('devices', ['ip' => '192.168.1.103']);
$piFour = $I->haveRecord('devices', ['ip' => '192.168.1.104', 'mac' => 'DD:44:EE:55:FF:66', 'name' => 'Auto Pi with group', 'public' => 'auto', 'group' => 'my-group', 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
$piFour = $I->grabRecord('devices', ['ip' => '192.168.1.104']);
$I->sendGET('devices');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContainsJson(['data' => ['ip' => '192.168.1.101', 'name' => 'Public Pi', 'on_home_page' => 'true', 'group' => null, 'device_added' => \Carbon\Carbon::parse($piOne->created_at)->toIso8601String(), 'last_contact' => \Carbon\Carbon::parse($piOne->updated_at)->toIso8601String()]]);
$I->dontSeeResponseContainsJson(['data' => ['ip' => '192.168.1.102', 'name' => 'Private Pi', 'on_home_page' => 'false', 'group' => null, 'device_added' => \Carbon\Carbon::parse($piTwo->created_at)->toIso8601String(), 'last_contact' => \Carbon\Carbon::parse($piTwo->updated_at)->toIso8601String()]]);
$I->seeResponseContainsJson(['data' => ['ip' => '192.168.1.103', 'name' => 'Auto Pi without group', 'on_home_page' => 'auto', 'group' => null, 'device_added' => \Carbon\Carbon::parse($piTwo->created_at)->toIso8601String(), 'last_contact' => \Carbon\Carbon::parse($piTwo->updated_at)->toIso8601String()]]);
$I->dontSeeResponseContainsJson(['data' => ['ip' => '192.168.1.104', 'name' => 'Auto Pi with group', 'on_home_page' => 'auto', 'group' => 'my-group', 'device_added' => \Carbon\Carbon::parse($piTwo->created_at)->toIso8601String(), 'last_contact' => \Carbon\Carbon::parse($piTwo->updated_at)->toIso8601String()]]);
$I->sendGET('devices/@my-group');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContainsJson(['data' => ['name' => 'Auto Pi with group']]);
$I->dontSeeResponseContainsJson(['data' => ['name' => 'Auto Pi without group']]);
$I->dontSeeResponseContainsJson(['data' => ['name' => 'Private Pi']]);
$I->dontSeeResponseContainsJson(['data' => ['name' => 'Public Pi']]);
開發者ID:4mb,項目名稱:pi.strebl.ch,代碼行數:26,代碼來源:GetAllDevicesCept.php


注:本文中的ApiTester::dontSeeResponseContainsJson方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。