File: /home/aliazzsr/api.crm.vqode.com/tests/ksa/AddingSystemsCept.php
<?php
/**
* @var \Codeception\Scenario $scenario
*/
$I = new KsaTester($scenario);
$I->wantTo('create a new project with specification');
$I->login();
$I->comment('creating a new project');
$newProject = $I->getFakeProject();
$I->sendPOST('projects', $newProject);
$I->seeResponseCodeIs(\Codeception\Util\HttpCode::CREATED);
$I->seeResponseJsonMatchesJsonPath('$.id');
unset($newProject['edv']);
$I->seeResponseContainsJson($newProject);
$projectId = json_decode($I->grabResponse())->id;
$I->comment('adding a new partition to the project');
$partition = $I->getFakePartition();
$I->sendPOST("projects/{$projectId}/specifications", $partition);
$I->seeResponseCodeIs(\Codeception\Util\HttpCode::CREATED);
$I->seeResponseJsonMatchesJsonPath('$.id');
$I->seeResponseContainsJson($partition);
$I->comment('adding a new lining 155 to the project');
$lining155 = $I->getFakeLining155();
$I->sendPOST("projects/{$projectId}/specifications", $lining155);
$I->seeResponseCodeIs(\Codeception\Util\HttpCode::CREATED);
$I->seeResponseJsonMatchesJsonPath('$.id');
$I->seeResponseContainsJson($lining155);
$I->comment('adding a new lining 165 to the project');
$lining165 = $I->getFakeLining165();
$I->sendPOST("projects/{$projectId}/specifications", $lining165);
$I->seeResponseCodeIs(\Codeception\Util\HttpCode::CREATED);
$I->seeResponseJsonMatchesJsonPath('$.id');
$I->seeResponseContainsJson($lining165);
$I->comment('adding a new lining 175 to the project');
$lining175 = $I->getFakeLining175();
$I->sendPOST("projects/{$projectId}/specifications", $lining175);
$I->seeResponseCodeIs(\Codeception\Util\HttpCode::CREATED);
$I->seeResponseJsonMatchesJsonPath('$.id');
$I->seeResponseContainsJson($lining175);
$I->comment('adding a new encasement to the project');
$encase = $I->getFakeEncasement();
$I->sendPOST("projects/{$projectId}/specifications", $encase);
$I->seeResponseCodeIs(\Codeception\Util\HttpCode::CREATED);
$I->seeResponseJsonMatchesJsonPath('$.id');
$I->seeResponseContainsJson($encase);
$I->comment('adding a new ceiling 225 to the project');
$ceil225 = $I->getFakeCeiling225();
$I->sendPOST("projects/{$projectId}/specifications", $ceil225);
$I->seeResponseCodeIs(\Codeception\Util\HttpCode::CREATED);
$I->seeResponseJsonMatchesJsonPath('$.id');
$I->seeResponseContainsJson($ceil225);
$I->comment('adding a new ceiling 225a to the project');
$ceil225a = $I->getFakeCeiling225A();
$I->sendPOST("projects/{$projectId}/specifications", $ceil225a);
$I->seeResponseCodeIs(\Codeception\Util\HttpCode::CREATED);
$I->seeResponseJsonMatchesJsonPath('$.id');
$I->seeResponseContainsJson($ceil225a);
$I->comment('adding a new ceiling 225b to the project');
$ceil225b = $I->getFakeCeiling225B();
$I->sendPOST("projects/{$projectId}/specifications", $ceil225b);
$I->seeResponseCodeIs(\Codeception\Util\HttpCode::CREATED);
$I->seeResponseJsonMatchesJsonPath('$.id');
$I->seeResponseContainsJson($ceil225b);
$I->comment('adding a new ceiling 226 to the project');
$ceil226 = $I->getFakeCeiling226();
$I->sendPOST("projects/{$projectId}/specifications", $ceil226);
$I->seeResponseCodeIs(\Codeception\Util\HttpCode::CREATED);
$I->seeResponseJsonMatchesJsonPath('$.id');
$I->seeResponseContainsJson($ceil226);
$I->comment('adding a new ceiling 226a to the project');
$ceil226a = $I->getFakeCeiling226A();
$I->sendPOST("projects/{$projectId}/specifications", $ceil226a);
$I->seeResponseCodeIs(\Codeception\Util\HttpCode::CREATED);
$I->seeResponseJsonMatchesJsonPath('$.id');
$I->seeResponseContainsJson($ceil226a);
$I->comment('adding a new ceiling 226b to the project');
$ceil226b = $I->getFakeCeiling226B();
$I->sendPOST("projects/{$projectId}/specifications", $ceil226b);
$I->seeResponseCodeIs(\Codeception\Util\HttpCode::CREATED);
$I->seeResponseJsonMatchesJsonPath('$.id');
$I->seeResponseContainsJson($ceil226b);
$I->comment('adding a new floor to the project');
$floor = $I->getFakeFloor();
$I->sendPOST("projects/{$projectId}/specifications", $floor);
$I->seeResponseCodeIs(\Codeception\Util\HttpCode::CREATED);
$I->seeResponseJsonMatchesJsonPath('$.id');
$I->seeResponseJsonMatchesJsonPath('$.name');
$I->seeResponseContainsJson($floor);