示例#1
0
 public function testApplicationJsonSubtypeIncludesObjectSerialized()
 {
     $this->module->haveHttpHeader('Content-Type', 'application/resource+json');
     $this->module->sendPOST('/', new JsonSerializedItem());
     /** @var $request \Symfony\Component\BrowserKit\Request  **/
     $request = $this->module->client->getRequest();
     $this->assertContains('application/resource+json', $request->getServer());
     $this->assertJson($request->getContent());
 }
示例#2
0
 public function testGetApplicationJsonNotIncludesJsonAsContent()
 {
     $this->module->haveHttpHeader('Content-Type', 'application/json');
     $this->module->sendGET('/', array('name' => 'john'));
     /** @var $request \Symfony\Component\BrowserKit\Request  **/
     $request = $this->module->client->getRequest();
     $this->assertNull($request->getContent());
     $this->assertContains('john', $request->getParameters());
 }
 /**
  * @Issue https://github.com/Codeception/Codeception/issues/1650
  */
 public function testHostHeaders()
 {
     if (version_compare(PHP_VERSION, '5.5.0', '<')) {
         $this->markTestSkipped('only for php 5.5');
     }
     $this->module->haveHttpHeader('Host', 'http://www.example.com');
     $this->module->sendGET('/rest/ping/');
     $this->module->seeResponseContains('host: http://www.example.com');
 }
 /**
  * @Issue https://github.com/Codeception/Codeception/issues/1650
  */
 public function testHostHeader()
 {
     if (getenv('dependencies') === 'lowest') {
         $this->markTestSkipped('This test can\'t pass with the lowest versions of dependencies');
     }
     $this->module->sendGET('/rest/http-host/');
     $this->module->seeResponseContains('host: "localhost:8010"');
     $this->module->haveHttpHeader('Host', 'www.example.com');
     $this->module->sendGET('/rest/http-host/');
     $this->module->seeResponseContains('host: "www.example.com"');
 }
示例#5
0
 function getStreetNameById($id)
 {
     $this->restModule->haveHttpHeader('Content-Type', 'application/json');
     $city = $this->getCity(4);
     $this->restModule->sendGET('/lists/streets/' . $city);
     $streets = $this->restModule->grabResponse();
     $streetName = json_decode($streets)[$id]->name;
     //$this->debugSection('Street ID', $streetName);
     file_put_contents(codecept_data_dir('streets_name.json'), $streets);
     return $streetName;
 }
 /**
  * @Issue https://github.com/Codeception/Codeception/issues/2070
  */
 public function testArrayOfZeroesInJsonResponse()
 {
     $this->module->haveHttpHeader('Content-Type', 'application/json');
     $this->module->sendGET('/rest/zeroes');
     $this->module->dontSeeResponseContainsJson(['responseCode' => 0, 'data' => [0, 0, 0]]);
 }