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


PHP ApiTester::seeResponseCodeIs方法代码示例

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


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

示例1: testCaptureFlag

 public function testCaptureFlag()
 {
     $token = $this->doLogin('player1@mailinator.com', '123456');
     $this->tester->haveHttpHeader('Content-type', 'application/json');
     $this->tester->haveHttpHeader('X-Api-token', $token);
     $region = rand(1, 4);
     $this->tester->sendPOST('/api/capture-flag', json_encode(['regionId' => $region]));
     $this->tester->seeResponseCodeIs(200);
     $this->tester->seeResponseIsJson();
     $this->tester->haveHttpHeader('Content-type', 'application/json');
     $this->tester->haveHttpHeader('X-Api-token', $token);
     $this->tester->sendGET('/api/player-status');
     $this->tester->seeResponseCodeIs(200);
     $this->tester->seeResponseIsJson();
     $data = json_decode($this->tester->grabResponse(), true);
     $myTeamId = $data['data']['id'];
     $this->tester->haveHttpHeader('Content-type', 'application/json');
     $this->tester->sendGET('/api/game-status/1');
     $this->tester->seeResponseCodeIs(200);
     $this->tester->seeResponseIsJson();
     $data = json_decode($this->tester->grabResponse(), true);
     $data = $data['data'];
     $this->assertArrayHasKey('ownerRegion1', $data);
     $this->assertArrayHasKey('ownerRegion2', $data);
     $this->assertArrayHasKey('ownerRegion3', $data);
     $this->assertArrayHasKey('ownerRegion4', $data);
     //        $this->assertEquals($data['ownerRegion' . $region]['id'], $myTeamId);
 }
开发者ID:excrucio,项目名称:RSC2015R-returnCaca,代码行数:28,代码来源:ApiCaptureFlagTest.php

示例2: checkLocationList

 private function checkLocationList()
 {
     $this->tester->seeResponseCodeIs(200);
     $this->tester->seeResponseIsJson();
     $this->tester->seeResponseJsonMatchesJsonPath('$.status');
     $this->tester->seeResponseJsonMatchesJsonPath('$.data');
     $this->tester->seeResponseJsonMatchesJsonPath('$.data[0].lat');
     $this->tester->seeResponseJsonMatchesJsonPath('$.data[0].lng');
     $this->tester->seeResponseJsonMatchesJsonPath('$.data[0].game');
 }
开发者ID:excrucio,项目名称:RSC2015R-returnCaca,代码行数:10,代码来源:ApiLocationTest.php

示例3: doCheckLogout

 public function doCheckLogout($token)
 {
     // Do Logout
     $this->tester->haveHttpHeader('Content-type', 'application/json');
     $this->tester->haveHttpHeader('X-Api-Token', $token);
     $this->tester->sendPOST('/api/logout');
     $this->tester->seeResponseCodeIs(200);
     $this->tester->seeResponseIsJson();
     // Check is logged out
     $this->checkIsLogin($token, false);
 }
开发者ID:excrucio,项目名称:RSC2015R-returnCaca,代码行数:11,代码来源:TestApiLoginLogoutTest.php

示例4: delete

 /**
  * @depends update
  */
 public function delete(ApiTester $I)
 {
     $I->wantTo('Delete a new Contact in com_contacts using DELETE');
     $I->amHttpAuthenticated('admin', 'admin');
     $I->sendDELETE('index.php' . '?option=contact' . '&api=Hal' . '&webserviceClient=administrator' . '&webserviceVersion=1.0.0' . "&id={$this->id}");
     $I->seeResponseCodeIs(200);
     $I->sendGET('index.php' . '?option=contact' . '&api=Hal' . '&webserviceClient=administrator' . '&webserviceVersion=1.0.0' . "&id={$this->id}");
     $I->seeResponseCodeIs(404);
     $I->seeResponseIsJson();
     $I->seeResponseContains('"message":"Item not found with given key.","code":404,"type":"Exception"');
 }
开发者ID:thangredweb,项目名称:redCORE,代码行数:14,代码来源:administrator.contact.1.0.0.Cest.php

示例5: createPost

 public function createPost(ApiTester $I)
 {
     $I->sendPOST($this->endpoint, ['title' => 'Game of Rings', 'body' => 'By George Tolkien']);
     $I->seeResponseCodeIs(200);
     $I->seeResponseIsJson();
     $I->seeResponseContainsJson(['title' => 'Game of Rings']);
     $id = $I->grabDataFromJsonResponse('id');
     $I->seeRecord('posts', ['id' => $id, 'title' => 'Game of Rings']);
     $I->sendGET($this->endpoint . "/{$id}");
     $I->seeResponseCodeIs(200);
     $I->seeResponseIsJson();
     $I->seeResponseContainsJson(['title' => 'Game of Rings']);
 }
开发者ID:jenky,项目名称:laravel-api-starter,代码行数:13,代码来源:PostsResourceCest.php

示例6: testTestUsersCreation

 public function testTestUsersCreation(ApiTester $I)
 {
     $I->wantTo('make sure my test users have been created');
     $I->amHttpAuthenticated('admin', 'admin');
     $I->sendGET($this->baseUrl . '/users/' . $this->userId);
     $I->seeResponseCodeIs(200);
     $I->seeResponseIsXml();
     $I->seeXmlResponseIncludes(XmlUtils::toXml(['status' => 'ok']));
     $I->sendGET($this->baseUrl . '/users/' . $this->sharerUserId);
     $I->seeResponseCodeIs(200);
     $I->seeResponseIsXml();
     $I->seeXmlResponseIncludes(XmlUtils::toXml(['status' => 'ok']));
 }
开发者ID:patman15,项目名称:galleryplus,代码行数:13,代码来源:CheckTestUsersCest.php

示例7: deletePost

 public function deletePost(ApiTester $I)
 {
     $id = $I->haveRecord('posts', $this->getPostAttributes(['title' => 'Game of Thrones']));
     $I->sendDELETE($this->endpoint . "/{$id}");
     $I->seeResponseCodeIs(200);
     $I->dontSeeRecord('posts', ['id' => $id]);
 }
开发者ID:resulaslan,项目名称:sample-l4-app,代码行数:7,代码来源:PostsResourceCest.php

示例8: deleteUser

 public function deleteUser(ApiTester $I, \Codeception\Scenario $scenario)
 {
     //$scenario->skip('ownCloud master is broken');
     $I->wantTo('delete the user');
     $I->amHttpAuthenticated('admin', 'admin');
     $I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
     $I->sendDELETE($this->apiUrl . '/users/' . $this->userId);
     $I->seeResponseCodeIs(200);
     $I->seeResponseIsXml();
     $I->seeXmlResponseIncludes(XmlUtils::toXml(['status' => 'ok']));
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:11,代码来源:OcsCreateUserCest.php

示例9: deleteDiscussion

 public function deleteDiscussion(ApiTester $I)
 {
     $I->wantTo('delete a discussion via API');
     $user = $I->amAuthenticated();
     $user->groups()->attach(4);
     // Make the user a moderator
     $discussion = Factory::create('Flarum\\Core\\Models\\Discussion', ['start_user_id' => $user->id]);
     $I->sendDELETE($this->endpoint . '/' . $discussion->id);
     $I->seeResponseCodeIs(204);
     $I->seeResponseEquals('');
     $I->expect('the discussion was deleted in the database');
     $I->dontSeeRecord('discussions', ['id' => $discussion->id]);
 }
开发者ID:Qiang1234,项目名称:core,代码行数:13,代码来源:DiscussionsResourceCest.php

示例10: checkStatList

 private function checkStatList()
 {
     $this->tester->seeResponseCodeIs(200);
     $this->tester->seeResponseIsJson();
     $data = json_decode($this->tester->grabResponse(), true);
     $this->tester->seeResponseJsonMatchesJsonPath('$.status');
     $this->tester->seeResponseJsonMatchesJsonPath('$.data');
     foreach ($data['data']['stats'] as $item) {
         $this->assertArrayHasKey('team', $item);
         $this->assertArrayHasKey('player', $item);
         $this->assertArrayHasKey('id', $item['player']);
         $this->assertArrayHasKey('alias', $item['player']);
         $this->assertArrayHasKey('level', $item['player']);
         $this->assertArrayHasKey('isLive', $item['player']);
         $this->assertArrayHasKey('isLive', $item);
         $this->assertArrayHasKey('location', $item);
         $this->assertArrayHasKey('player', $item['location']);
         $this->assertArrayHasKey('lat', $item['location']);
         $this->assertArrayHasKey('lng', $item['location']);
         $this->assertArrayHasKey('game', $item['location']);
     }
 }
开发者ID:excrucio,项目名称:RSC2015R-returnCaca,代码行数:22,代码来源:ApiStatsTest.php

示例11: ApiTester

<?php

use Codeception\Util\Fixtures;
/** @var Faker\Generator $faker */
$faker = Fixtures::get('faker');
$devs = Fixtures::get('devs');
$I = new ApiTester($scenario);
$I->wantTo('get the user price based on the GitHub API');
$I->amGoingTo('Get a non-existent user');
$I->sendGET('dev/' . $faker->lexify('??????????'));
$I->seeResponseCodeIs(404);
$I->amGoingTo('Get an existent user');
$I->sendGET('dev/' . $devs[array_rand($devs)]);
$I->seeResponseCodeIs(200);
$dev = json_decode($I->grabResponse());
$I->assertTrue(is_numeric($dev->rate), 'rate is numeric');
$I->assertTrue(is_string($dev->username) && strlen($dev->username) != 0, 'username is present and is string');
开发者ID:igorsantos07,项目名称:developer-shop,代码行数:17,代码来源:DetailsCept.php

示例12: ApiTester

<?php

$request_body = ['interaction_id' => 'SD000000099', 'category' => 'Laptop', 'issue' => 'Wont turn on!', 'status' => 'Submitted', 'description' => 'Yes, I have it plugged in!', 'affected_service' => 'Laptop', 'notify_type' => 'CALLME', 'phase' => 'WIP', 'last_update_date' => '7-7-17, 7:57:57 PM EDT'];
$response_body = ['status' => 'Successful update'];
$I = new ApiTester($scenario);
$I->wantTo('update a ticket');
$I->haveHttpHeader('Content-Type', 'application/json');
$I->sendPOST('/tickets/', $request_body);
$I->seeResponseCodeIs(201);
$I->seeResponseIsJson();
$I->seeResponseContainsJson($response_body);
开发者ID:GM-Team,项目名称:web,代码行数:11,代码来源:UpdateCept.php

示例13: missingRateError

 /**
  * @param \ApiTester $I
  */
 public function missingRateError(ApiTester $I)
 {
     $I->wantTo('Error while saving: missing rate.');
     $I->sendPost('http://currencyfairtest.com/api/messages', ["userId" => "100", "currencyFrom" => "EUR", "amountSell" => "999.0000", "timePlaced" => "31-AUG-15 22:00:00"]);
     $I->seeResponseCodeIs(400);
     $I->seeResponseIsJson();
     $I->seeResponseContains('ERROR');
     $I->seeResponseContains('rate');
     $I->seeResponseContains('The rate field is required.');
 }
开发者ID:biroa,项目名称:cf,代码行数:13,代码来源:ConversionMessageCest.php

示例14: ApiTester

<?php

$I = new ApiTester($scenario);
$I->wantTo('get new pid for a user');
$I->haveHttpHeader(' Content-Type', 'xxyyzz');
$I->sendPOST('http://localhost/api/v1/action/GetPid.php', json_encode(array('action' => 'GetPid')));
$I->seeResponseCodeIs(400);
$I->seeResponseIsJson();
开发者ID:NormantasKudzma,项目名称:BomberwebPhp,代码行数:8,代码来源:GetPidPostBadHeaderCept.php

示例15: ApiTester

<?php

include 'version.php';
$I = new ApiTester($scenario);
$I->wantTo('fetch the version information for the web app');
$I->sendGET('version');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContainsJson(["api_version" => $api_version, "app_version" => $app_version, "webapp_version" => $webapp_version]);
开发者ID:tom2320x,项目名称:list,代码行数:9,代码来源:GetVersionCept.php


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