Amal_Udjir/tests/Unit/MySQLiConnectionTest.php

30 lines
703 B
PHP
Raw Permalink Normal View History

2025-04-22 03:10:07 +00:00
<?php
namespace Tests\Unit;
use Codeception\Test\Unit;
use Codeception\Util\Stub;
class MySQLiConnectionTest extends Unit
{
protected $tester;
public function testMysqliconnection()
{
// Data koneksi database
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "iclop";
// Membuat koneksi
$conn = new \mysqli($servername, $username, $password, $dbname);
// Cek apakah koneksi berhasil
$this->assertTrue($conn->connect_error === null, "Koneksi MySQLi gagal: " . $conn->connect_error);
// Tutup koneksi setelah tes
$conn->close();
}
}