Files
models/tests/MySQLRequirementsTest.php
2019-09-13 17:42:23 -03:00

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);
}
}