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/UsersCept.php
<?php 
$I = new ApiTester($scenario);
$I->wantTo('work on users');

$I->login();

$I->comment('creating a new user');

$faker = \Faker\Factory::create();
$password = $faker->regexify('[a-z]{4}[A-Z]{4}[0-9]{4}');
$newUser = [
    'name' => $faker->name,
    'email' => $faker->email,
    'password' => $password,
    'role_id' => \app\models\core\Role::USER,
];
$I->sendPOST('users', $newUser);
$I->seeResponseCodeIs(\Codeception\Util\HttpCode::CREATED);
$I->canSeeResponseIsJson();
unset($newUser['password']);
$I->seeResponseContainsJson($newUser);
$I->seeResponseJsonMatchesJsonPath('$.id');
$userCreated = json_decode($I->grabResponse());

$I->comment('can login as a new user');
$I->login(['username' => $userCreated->email, 'password' => $password, 'acceptEula' => true]);

$I->comment('deleting the created user');
$I->login();
$I->sendDELETE('users/' . $userCreated->id);
$I->seeResponseCodeIs(\Codeception\Util\HttpCode::NO_CONTENT);
$I->dontSeeInDatabase('user', ['id' => $userCreated->id]);