HEX
Server: LiteSpeed
System: Linux premium260.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64
User: aliazzsr (627)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/aliazzsr/api.crm.vqode.com/tests/api/ProjectsUpdateCept.php
<?php
$I = new ApiTester($scenario);
$I->wantTo('update project');

$I->comment('updating project');
$I->login();

$faker = \Faker\Factory::create();

$stages = array_map('intval', $I->grabColumnFromDatabase('stage', 'id'));
$sectors = array_map('intval', $I->grabColumnFromDatabase('sector', 'id'));
$ribas = array_map('intval', $I->grabColumnFromDatabase('riba', 'id'));

$projectJson = $I->getRandomProjectJSON();
$I->sendPOST('projects', $projectJson);
$I->seeResponseCodeIs(\Codeception\Util\HttpCode::CREATED);

$newProject = json_decode($I->grabResponse());

$projectJson = [
    'name' => $faker->company,
    'created' => '01/02/2003',
];
$I->sendPUT('projects/' . $newProject->id, $projectJson);
$I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
$updProject = json_decode($I->grabResponse());

$I->assertEquals($newProject->created, $updProject->created);
$I->assertNotEquals('01/02/2003', $updProject->created);