diff options
Diffstat (limited to 'tests_integration/LoginTest.php')
| -rw-r--r-- | tests_integration/LoginTest.php | 39 |
1 files changed, 1 insertions, 38 deletions
diff --git a/tests_integration/LoginTest.php b/tests_integration/LoginTest.php index 3e155d8..6d685c7 100644 --- a/tests_integration/LoginTest.php +++ b/tests_integration/LoginTest.php @@ -1,45 +1,8 @@ <?php use PHPUnit\Framework\TestCase; -final class LoginTest extends TestCase +final class LoginTest extends ApiTestCase { - private string $apiUrl; - - protected function setUp(): void - { - $this->apiUrl = getenv('API_URL') ?: 'http://localhost:9080/backend.php'; - } - - /** - * Make an HTTP POST request and return [status_code, decoded_body]. - * @param array<string, string> $data - * @return array<int, mixed> - */ - private function post(string $endpoint, array $data): array - { - $ch = curl_init($endpoint); - curl_setopt_array($ch, [ - CURLOPT_RETURNTRANSFER => true, - CURLOPT_POST => true, - CURLOPT_POSTFIELDS => http_build_query($data), - CURLOPT_TIMEOUT => 10, - CURLOPT_CONNECTTIMEOUT => 5, - ]); - $body = curl_exec($ch); - $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); - $errno = curl_errno($ch); - $error = curl_error($ch); - curl_close($ch); - - if ($errno) { - $this->fail("cURL error ($errno): $error"); - } - - /** @var array<string, mixed>|null $decoded */ - $decoded = json_decode($body, true); - return [$status, $decoded ?? []]; - } - // ── Successful login ────────────────────────────────────────────────────── public function test_perform_login_success(): void |
