示例#1
10
 public function testFileUploadWithFilesArray()
 {
     $tmpFileName = tempnam('/tmp', 'test_');
     file_put_contents($tmpFileName, 'test data');
     $files = ['file' => ['name' => 'file.txt', 'type' => 'text/plain', 'size' => 9, 'tmp_name' => $tmpFileName]];
     $this->module->sendPOST('/rest/file-upload', [], $files);
     $this->module->seeResponseContainsJson(['uploaded' => true]);
 }
示例#2
0
 public function testPut()
 {
     $this->module->sendPUT('/rest/user/', array('name' => 'laura'));
     $this->module->seeResponseContains('*****@*****.**');
     $this->module->seeResponseContainsJson(array('name' => 'laura'));
     $this->module->dontSeeResponseContainsJson(array('name' => 'john'));
 }
示例#3
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);
 }
示例#4
0
 public function testArrayJson()
 {
     $this->module->response = '[{"id":1,"title": "Bug should be fixed"},{"title": "Feature should be implemented","id":2}]';
     $this->module->seeResponseContainsJson(['id' => 1]);
 }