Refactor configuration test to use nested array keys.

This commit is contained in:
netkas 2024-09-24 15:00:12 -04:00
parent 4879fdf36d
commit 624b1f45b6

View file

@ -20,19 +20,19 @@ class ConfigurationTest extends TestCase
$this->assertIsArray($config, "Configuration should be an array."); $this->assertIsArray($config, "Configuration should be an array.");
//Assert that all the default configuration exists //Assert that all the default configuration exists
$this->assertArrayHasKey('database.host', $config); $this->assertArrayHasKey('host', $config['database']);
$this->assertEquals($config['database.host'], '127.0.0.1'); $this->assertEquals($config['database']['host'], '127.0.0.1');
$this->assertArrayHasKey('database.port', $config); $this->assertArrayHasKey('port', $config['database']);
$this->assertEquals($config['database.port'], 3306); $this->assertEquals($config['database']['port'], 3306);
$this->assertArrayHasKey('database.username', $config); $this->assertArrayHasKey('username', $config['database']);
$this->assertEquals($config['database.username'], 'root'); $this->assertEquals($config['database']['username'], 'root');
$this->assertArrayHasKey('database.password', $config); $this->assertArrayHasKey('password', $config['database']);
$this->assertNull($config['database.password'], 'null should be the value of database.password.'); $this->assertNull($config['database']['password'], 'null should be the value of database.password.');
$this->assertArrayHasKey('database.name', $config); $this->assertArrayHasKey('name', $config['database']);
$this->assertEquals($config['database.name'], 'test'); $this->assertEquals($config['database']['name'], 'test');
} }
} }