예제 #1
2
파일: RestTest.php 프로젝트: corcre/elabftw
 public function testPut()
 {
     $this->module->sendPUT('/rest/user/', ['name' => 'laura']);
     $this->module->seeResponseContains('*****@*****.**');
     $this->module->seeResponseContainsJson(['name' => 'laura']);
     $this->module->dontSeeResponseContainsJson(['name' => 'john']);
 }
예제 #2
1
 /**
  * @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"');
 }
예제 #4
0
 /**
  * @Issue https://github.com/Codeception/Codeception/issues/2075
  * Client is undefined for the second test
  */
 public function testTwoTests()
 {
     $cest1 = Stub::makeEmpty('\\Codeception\\TestCase\\Cest');
     $cest2 = Stub::makeEmpty('\\Codeception\\TestCase\\Cest');
     $this->module->sendGET('/rest/user/');
     $this->module->seeResponseIsJson();
     $this->module->seeResponseContains('davert');
     $this->module->seeResponseContainsJson(array('name' => 'davert'));
     $this->module->seeResponseCodeIs(200);
     $this->module->dontSeeResponseCodeIs(404);
     $this->phpBrowser->_after($cest1);
     $this->module->_after($cest1);
     $this->module->_before($cest2);
     $this->phpBrowser->_before($cest2);
     $this->module->sendGET('/rest/user/');
     $this->module->seeResponseIsJson();
     $this->module->seeResponseContains('davert');
     $this->module->seeResponseContainsJson(array('name' => 'davert'));
     $this->module->seeResponseCodeIs(200);
     $this->module->dontSeeResponseCodeIs(404);
 }
예제 #5
0
 public function testPost()
 {
     $this->module->sendPOST('/rest/user/', array('name' => 'john'));
     $this->module->seeResponseContains('john');
     $this->module->seeResponseContainsJson(array('name' => 'john'));
 }