Add some semblance of testing.
This commit is contained in:
29
tests/ConfigurationTest.php
Normal file
29
tests/ConfigurationTest.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace tests\FooBar;
|
||||
|
||||
use FooBar\Configuration;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ConfigurationTest extends TestCase
|
||||
{
|
||||
public function testDefaultSecurity()
|
||||
{
|
||||
$config = $this->getSampleConfig();
|
||||
|
||||
$this->assertTrue($config->isAuthorized('127.0.0.1'));
|
||||
$this->assertFalse($config->isAuthorized('8.8.8.8'));
|
||||
}
|
||||
|
||||
public function testLoadConfig()
|
||||
{
|
||||
$this->assertNotNull(Configuration::loadConfig());
|
||||
}
|
||||
|
||||
private function getSampleConfig(): Configuration
|
||||
{
|
||||
$path = dirname(__DIR__) . '/config/config.sample.php';
|
||||
|
||||
return new Configuration(require $path);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user