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

PhpcrOdmTestCase::createImage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 4
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