|
@@ -18,9 +18,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
|
|
|
{
|
|
|
public function testOptions()
|
|
|
{
|
|
|
- $processor = new Processor();
|
|
|
-
|
|
|
- $config = $processor->processConfiguration(new Configuration(), array());
|
|
|
+ $config = $this->process(array());
|
|
|
|
|
|
$this->assertTrue($config['options']['html5_validate']);
|
|
|
$this->assertNull($config['options']['pager_links']);
|
|
@@ -32,9 +30,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
|
|
|
{
|
|
|
$this->setExpectedException('Symfony\Component\Config\Definition\Exception\InvalidTypeException');
|
|
|
|
|
|
- $processor = new Processor();
|
|
|
-
|
|
|
- $config = $processor->processConfiguration(new Configuration(), array(array(
|
|
|
+ $config = $this->process(array(array(
|
|
|
'options' => array(
|
|
|
'html5_validate' => '1',
|
|
|
),
|
|
@@ -43,9 +39,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
|
|
|
|
|
|
public function testCustomTemplatesPerAdmin()
|
|
|
{
|
|
|
- $processor = new Processor();
|
|
|
-
|
|
|
- $config = $processor->processConfiguration(new Configuration(), array(array(
|
|
|
+ $config = $this->process(array(array(
|
|
|
'admin_services' => array(
|
|
|
'my_admin_id' => array(
|
|
|
'templates' => array(
|
|
@@ -62,9 +56,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
|
|
|
|
|
|
public function testAdminServicesDefault()
|
|
|
{
|
|
|
- $processor = new Processor();
|
|
|
-
|
|
|
- $config = $processor->processConfiguration(new Configuration(), array(array(
|
|
|
+ $config = $this->process(array(array(
|
|
|
'admin_services' => array('my_admin_id' => array()),
|
|
|
)));
|
|
|
|
|
@@ -94,16 +86,14 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
|
|
|
|
|
|
public function testDashboardWithoutRoles()
|
|
|
{
|
|
|
- $processor = new Processor();
|
|
|
- $config = $processor->processConfiguration(new Configuration(), array());
|
|
|
+ $config = $this->process(array());
|
|
|
|
|
|
$this->assertEmpty($config['dashboard']['blocks'][0]['roles']);
|
|
|
}
|
|
|
|
|
|
public function testDashboardWithRoles()
|
|
|
{
|
|
|
- $processor = new Processor();
|
|
|
- $config = $processor->processConfiguration(new Configuration(), array(array(
|
|
|
+ $config = $this->process(array(array(
|
|
|
'dashboard' => array(
|
|
|
'blocks' => array(array(
|
|
|
'roles' => array('ROLE_ADMIN'),
|
|
@@ -117,8 +107,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
|
|
|
|
|
|
public function testDashboardGroups()
|
|
|
{
|
|
|
- $processor = new Processor();
|
|
|
- $config = $processor->processConfiguration(new Configuration(), array(array(
|
|
|
+ $config = $this->process(array(array(
|
|
|
'dashboard' => array(
|
|
|
'groups' => array(
|
|
|
'bar' => array(
|
|
@@ -185,8 +174,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
|
|
|
{
|
|
|
$this->setExpectedException('\InvalidArgumentException', 'Expected either parameters "route" and "label" for array items');
|
|
|
|
|
|
- $processor = new Processor();
|
|
|
- $config = $processor->processConfiguration(new Configuration(), array(array(
|
|
|
+ $config = $this->process(array(array(
|
|
|
'dashboard' => array(
|
|
|
'groups' => array(
|
|
|
'bar' => array(
|
|
@@ -204,4 +192,18 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
|
|
|
),
|
|
|
)));
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Processes an array of configurations and returns a compiled version.
|
|
|
+ *
|
|
|
+ * @param array $configs An array of raw configurations
|
|
|
+ *
|
|
|
+ * @return array A normalized array
|
|
|
+ */
|
|
|
+ protected function process($configs)
|
|
|
+ {
|
|
|
+ $processor = new Processor();
|
|
|
+
|
|
|
+ return $processor->processConfiguration(new Configuration(), $configs);
|
|
|
+ }
|
|
|
}
|