Files
FOSSBilling/tests/Modules/Client/GuestTest.php
T
Belle Aerni 0493c3a3e5 Further test improvements (#2122)
* Slight structure change to the testcases

* Fix

* Ported some random low-level tests

* Spelling

* Ported over some other low-level tests

* Fixes

* And now other fixes

* Another one
2024-02-06 13:13:04 -08:00

33 lines
954 B
PHP

<?php
declare(strict_types=1);
namespace ClientTests;
use APIHelper\Request;
use PHPUnit\Framework\TestCase;
final class GuestTest extends TestCase
{
public function testCreateAndDestroyClient(): void
{
// Generate a new test user
$password = 'A' . bin2hex(random_bytes(6));
$result = Request::makeRequest('guest/client/create', [
'email' => 'client@example.com',
'first_name' => 'Test',
'password' => $password,
'password_confirm' => $password,
]);
$this->assertTrue($result->wasSuccessful(), $result->generatePHPUnitMessage());
$this->assertIsNumeric($result->getResult());
$id = intval($result->getResult());
$result = Request::makeRequest('admin/client/delete', ['id' => $id]);
$this->assertTrue($result->wasSuccessful(), $result->generatePHPUnitMessage());
$this->assertTrue($result->getResult());
}
}