Completed
Pull Request — master (#1)
by Daniel
10:00
created

PhpcrOdmTestCase   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getContainer() 0 8 1
A initPhpcr() 0 11 2
1
<?php
2
3
namespace Psi\Bridge\ObjectAgent\Doctrine\PhpcrOdm\Tests\Functional;
4
5
use Doctrine\ODM\PHPCR\DocumentManagerInterface;
6
use Psi\Component\ContentType\Tests\Functional\Example\Model\Article;
7
use Psi\Component\ContentType\Tests\Functional\Example\Model\Image;
8
use Doctrine\DBAL\DriverManager;
9
use PhpBench\DependencyInjection\Container;
10
11
class PhpcrOdmTestCase extends \PHPUnit_Framework_TestCase
12
{
13
    private $documentManager;
0 ignored issues
show
Unused Code introduced by
The property $documentManager is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
14
15
    protected function getContainer()
16
    {
17
        $container = new Container([
18
            \Psi\Bridge\ObjectAgent\Doctrine\PhpcrOdm\Tests\Functional\PhpcrOdmExtension::class
19
        ], []);
20
        $container->init();
21
        return $container;
22
    }
23
24
    protected function initPhpcr(DocumentManagerInterface $documentManager)
25
    {
26
        $session = $documentManager->getPhpcrSession();
27
28
        $rootNode = $session->getRootNode();
29
        if ($rootNode->hasNode('test')) {
30
            $rootNode->getNode('test')->remove();
31
        }
32
33
        $rootNode->addNode('test');
34
    }
35
}
36