szurubooru/tests/PrivilegeTest.php
Marcin Kurczewski 15eb2342b9 Moved public data to public_html/
This is going to improve caching.
2014-10-18 18:48:24 +02:00

27 lines
753 B
PHP

<?php
namespace Szurubooru\Tests;
class PrivilegeTest extends \Szurubooru\Tests\AbstractTestCase
{
public function testConstNaming()
{
$refl = new \ReflectionClass(\Szurubooru\Privilege::class);
foreach ($refl->getConstants() as $key => $value)
{
$value = strtoupper(ltrim(preg_replace('/[A-Z]/', '_\0', $value), '_'));
$this->assertEquals($key, $value);
}
}
public function testConfigSectionNaming()
{
$refl = new \ReflectionClass(\Szurubooru\Privilege::class);
$constants = array_values($refl->getConstants());
$config = \Szurubooru\Injector::get(\Szurubooru\Config::class);
foreach ($config->security->privileges as $key => $value)
{
$this->assertTrue(in_array($key, $constants), "$key not in constants");
}
}
}