Completed
Pull Request — master (#33)
by Daniel
16:52 queued 13:40
created

PhpcrOdmTestCase   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 0
loc 30
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getContainer() 0 4 1
A initPhpcr() 0 11 2
A createImage() 0 10 1
1
<?php
2
3
namespace Psi\Bridge\ContentType\Doctrine\PhpcrOdm\Tests\Functional;
4
5
use Doctrine\ODM\PHPCR\DocumentManagerInterface;
6
use Psi\Component\ContentType\Tests\Functional\Example\Model\Image;
7
8
class PhpcrOdmTestCase extends \PHPUnit_Framework_TestCase
9
{
10
    public function getContainer(array $config = [])
11
    {
12
        return new Container($config);
13
    }
14
15
    protected function initPhpcr(DocumentManagerInterface $documentManager)
16
    {
17
        $session = $documentManager->getPhpcrSession();
18
19
        $rootNode = $session->getRootNode();
20
        if ($rootNode->hasNode('test')) {
21
            $rootNode->getNode('test')->remove();
22
        }
23
24
        $rootNode->addNode('test');
25
    }
26
27
    protected function createImage($path, $width, $height, $mimeType)
28
    {
29
        $image = new Image();
30
        $image->path = $path;
31
        $image->width = $width;
32
        $image->height = $height;
33
        $image->mimetype = $mimeType;
34
35
        return $image;
36
    }
37
}
38