szurubooru/tests/PrivilegeTest.php

28 lines
753 B
PHP
Raw Normal View History

2014-09-06 10:00:26 +02:00
<?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), '_'));
2014-09-06 10:00:26 +02:00
$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);
2014-09-06 10:00:26 +02:00
foreach ($config->security->privileges as $key => $value)
{
$this->assertTrue(in_array($key, $constants), "$key not in constants");
}
}
}