Exemplo n.º 1
0
 public function testGet() {
     $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);
 }
Exemplo n.º 2
0
 function apiAgencyRegistration()
 {
     $agencyOfficeRegion0 = $this->getRegion(21);
     $agencyOfficeCity0 = $this->getCity(4);
     $agencyOfficeAddress0 = $this->getStreetNameById(1);
     $agencyOfficeRegion1 = $this->getRegion(21);
     $agencyOfficeCity1 = $this->getCity(4);
     $agencyOfficeAddress1 = $this->getStreetNameById(1);
     $this->restModule->haveHttpHeader('Content-Type', 'application/json');
     $this->restModule->sendPOST('/registration/agency', ['name' => User::$agencyName, 'subdomain' => User::uniqueSubdomain(), 'firstName' => User::$agencyfirstName, 'lastName' => User::$agencylastName, 'email' => User::uniqueApiAgencyEmail(), 'plainPassword' => User::$agencyRegPass, 'description' => User::$agencyDescription, 'logo' => User::getAgencyLogo(), 'userAvatar' => User::getAgencyAvatar(), 'offices' => [array('officeName' => User::$agencyOfficeName0, 'region' => $agencyOfficeRegion0, 'city' => $agencyOfficeCity0, 'address' => $agencyOfficeAddress0, 'officeNumbers' => User::$agencyOfficeNumbers0, 'phones' => [array('phone' => User::$agencyOfficePhoneNumber0_0), array('phone' => User::$agencyOfficePhoneNumber0_1)]), array('officeName' => User::$agencyOfficeName1, 'region' => $agencyOfficeRegion1, 'city' => $agencyOfficeCity1, 'address' => $agencyOfficeAddress1, 'officeNumbers' => User::$agencyOfficeNumbers1)], 'socialAccounts' => [array('facebook' => User::$agencySocialFb, 'vk' => User::$agencySocialVk)], 'schedule' => [array('dayOfWeek' => '1-5', 'startTime' => '09:00', 'endTime' => '18:00'), array('dayOfWeek' => '6', 'startTime' => '10:00', 'endTime' => '13:00')]]);
     $this->restModule->seeResponseCodeIs(201);
     $this->restModule->seeResponseIsJson();
     $agency_data = $this->restModule->grabResponse();
     file_put_contents(codecept_data_dir('agency_data.json'), $agency_data);
 }
Exemplo n.º 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);
 }
Exemplo n.º 4
0
 public function testCanInspectResultOfPhpBrowserRequest()
 {
     $this->phpBrowser->amOnPage('/rest/user/');
     $this->module->seeResponseCodeIs(200);
     $this->module->seeResponseIsJson();
 }