2024-09-24 14:20:49 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Socialbox\Classes;
|
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Socialbox's Configuration Test Class
|
|
|
|
*
|
|
|
|
* This is a test suite for testing the "getConfiguration" method in the "Configuration" class.
|
|
|
|
*/
|
|
|
|
class ConfigurationTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Test the "getConfiguration" method in "Configuration" class.
|
|
|
|
*/
|
|
|
|
public function testGetConfiguration(): void
|
|
|
|
{
|
|
|
|
$config = Configuration::getConfiguration();
|
|
|
|
$this->assertIsArray($config, "Configuration should be an array.");
|
|
|
|
|
|
|
|
//Assert that all the default configuration exists
|
2024-09-24 15:00:12 -04:00
|
|
|
$this->assertArrayHasKey('host', $config['database']);
|
2024-09-24 15:05:34 -04:00
|
|
|
$this->assertIsString($config['database']['host']);
|
2024-09-24 14:20:49 -04:00
|
|
|
|
2024-09-24 15:00:12 -04:00
|
|
|
$this->assertArrayHasKey('port', $config['database']);
|
2024-09-24 15:05:34 -04:00
|
|
|
$this->assertIsInt($config['database']['port'], 3306);
|
2024-09-24 14:20:49 -04:00
|
|
|
|
2024-09-24 15:00:12 -04:00
|
|
|
$this->assertArrayHasKey('username', $config['database']);
|
2024-09-24 15:05:34 -04:00
|
|
|
$this->assertIsString($config['database']['username']);
|
2024-09-24 14:20:49 -04:00
|
|
|
|
2024-09-24 15:00:12 -04:00
|
|
|
$this->assertArrayHasKey('password', $config['database']);
|
2024-09-24 15:05:34 -04:00
|
|
|
$this->assertIsString($config['database']['password']);
|
2024-09-24 14:20:49 -04:00
|
|
|
|
2024-09-24 15:00:12 -04:00
|
|
|
$this->assertArrayHasKey('name', $config['database']);
|
2024-09-24 15:05:34 -04:00
|
|
|
$this->assertIsString($config['database']['name']);
|
2024-09-24 14:20:49 -04:00
|
|
|
}
|
|
|
|
}
|