30 lines
650 B
PHP
30 lines
650 B
PHP
<?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);
|
|
}
|
|
}
|