38 lines
1019 B
PHP
38 lines
1019 B
PHP
|
<?php
|
||
|
use PHPUnit\Framework\TestCase;
|
||
|
use Aldarien\Models\MySQLRequirements;
|
||
|
|
||
|
class MySQLRequirementsTest extends TestCase {
|
||
|
public function testStart() {
|
||
|
$req = new MySQLRequirements();
|
||
|
$this->assertTrue(true);
|
||
|
}
|
||
|
public function testSpecs() {
|
||
|
$req = new MySQLRequirements();
|
||
|
$expected = ['host_name', 'host_port', 'database_name'];
|
||
|
$result = $req->dsnSpecs();
|
||
|
$this->assertEquals($expected, $result);
|
||
|
}
|
||
|
public function testGetDSN() {
|
||
|
$req = new MySQLRequirements();
|
||
|
$config = (object) [
|
||
|
'host' => (object) [
|
||
|
'name' => 'localhost',
|
||
|
'port' => 3306
|
||
|
],
|
||
|
'database' => (object) [
|
||
|
'name' => 'test_db'
|
||
|
]
|
||
|
];
|
||
|
$expected = 'mysql:host=localhost;port=3306;dbname=test_db';
|
||
|
$result = $req->getDSN($config);
|
||
|
$this->assertEquals($expected, $result);
|
||
|
}
|
||
|
public function testHasUser() {
|
||
|
$req = new MySQLRequirements();
|
||
|
$expected = true;
|
||
|
$result = $req->hasUser();
|
||
|
$this->assertEquals($expected, $result);
|
||
|
}
|
||
|
}
|