Add some semblance of testing.

This commit is contained in:
2019-03-13 16:07:54 +01:00
parent 8e669e62f3
commit dd6baeff09
4 changed files with 46 additions and 2 deletions

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