From b84c385bfc0964ee6e38f43c2f60d003df2ed6c1 Mon Sep 17 00:00:00 2001 From: Aldarien Date: Fri, 13 Sep 2019 17:42:23 -0300 Subject: [PATCH] Tests --- tests/MySQLRequirementsTest.php | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tests/MySQLRequirementsTest.php diff --git a/tests/MySQLRequirementsTest.php b/tests/MySQLRequirementsTest.php new file mode 100644 index 0000000..96eaf7b --- /dev/null +++ b/tests/MySQLRequirementsTest.php @@ -0,0 +1,37 @@ +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); + } +}