Tests
This commit is contained in:
37
tests/MySQLRequirementsTest.php
Normal file
37
tests/MySQLRequirementsTest.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user