当前位置: 首页>>代码示例>>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;未经允许,请勿转载。