Komang_Gede_Narariya_Suputra/iClOP-V2/tests/CheckConnection.php
2024-12-31 11:25:09 +07:00

30 lines
900 B
PHP

<?php
use PHPUnit\Framework\TestCase;
class CheckConnection extends TestCase
{
public function testFileRead()
{
// Start output buffering
ob_start();
// Include the PHP file
include __DIR__ . '/../storage/app/private/testingunit/testingunit.php';
// Get the output and end output buffering
$output = ob_get_clean();
// Check if the connection was successful
$this->assertTrue(mysqli_ping($conn), "Koneksi dengan MYSQL gagal");
// Check if the database exists
$result = mysqli_select_db($conn, $database);
$this->assertTrue($result, "Database gagal ditemukan atau dibuat");
// Close the connection
mysqli_close($conn);
}
}
?>