Completed
Pull Request — master (#453)
by Maximilian
08:52 queued 07:21
created

SonataDoctrinePHPCRAdminExtensionTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 51
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getContainerExtensions() 0 6 1
A testDocumentTreeDefaultValues() 0 19 1
A testDocumentTreeEnableMoveAndReorder() 0 21 1
1
<?php
2
3
/*
4
 * This file is part of the Sonata Project package.
5
 *
6
 * (c) Thomas Rabaix <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sonata\DoctrinePHPCRAdminBundle\Tests\DependencyInjection;
13
14
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase;
15
use Sonata\DoctrinePHPCRAdminBundle\DependencyInjection\SonataDoctrinePHPCRAdminExtension;
16
17
class SonataDoctrinePHPCRAdminExtensionTest extends AbstractExtensionTestCase
18
{
19
    public function getContainerExtensions()
20
    {
21
        return array(
22
           new SonataDoctrinePHPCRAdminExtension(),
23
        );
24
    }
25
26
    public function testDocumentTreeDefaultValues()
27
    {
28
        $this->container->setParameter(
29
            'kernel.bundles',
30
            array()
31
        );
32
        $this->load(array('document_tree' => array()));
33
34
        $this->assertContainerBuilderHasParameter(
35
            'sonata_admin_doctrine_phpcr.tree_block.configuration',
36
            array(
37
                'routing_defaults' => array(),
38
                'repository_name' => 'default',
39
                'sortable_by' => 'position',
40
                'move' => false,
41
                'reorder' => false,
42
            )
43
        );
44
    }
45
46
    public function testDocumentTreeEnableMoveAndReorder()
47
    {
48
        $this->container->setParameter(
49
            'kernel.bundles',
50
            array()
51
        );
52
        $this->load(
53
            array('document_tree' => array('move' => array('enabled' => true, 'reorder' => true)))
54
        );
55
56
        $this->assertContainerBuilderHasParameter(
57
            'sonata_admin_doctrine_phpcr.tree_block.configuration',
58
            array(
59
                'routing_defaults' => array(),
60
                'repository_name' => 'default',
61
                'sortable_by' => 'position',
62
                'move' => true,
63
                'reorder' => true,
64
            )
65
        );
66
    }
67
}
68