30 lines
703 B
PHP
30 lines
703 B
PHP
<?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();
|
|
}
|
|
}
|