DoctrineAdapterTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 4
Bugs 0 Features 1
Metric Value
wmc 2
c 4
b 0
f 1
lcom 1
cbo 2
dl 0
loc 19
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testConstructor() 0 8 1
A testFindByUuidWithInvalidUuidReturnsNull() 0 7 1
1
<?php
2
/**
3
 * @author Stefano Torresi (http://stefanotorresi.it)
4
 * @license See the file LICENSE.txt for copying permission.
5
 * ************************************************
6
 */
7
8
namespace Thorr\Persistence\Doctrine\Test\DataMapper;
9
10
use Doctrine\Common\Persistence\ObjectManager;
11
use PHPUnit_Framework_TestCase as TestCase;
12
use Thorr\Persistence\Doctrine\DataMapper\DoctrineAdapter;
13
use Thorr\Persistence\Entity\AbstractEntity;
14
15
/**
16
 * @covers Thorr\Persistence\Doctrine\DataMapper\DoctrineAdapter
17
 */
18
class DoctrineAdapterTest extends TestCase
19
{
20
    public function testConstructor()
21
    {
22
        $objectManager = $this->getMock(ObjectManager::class);
23
24
        $adapter = new DoctrineAdapter(AbstractEntity::class, $objectManager);
25
        $this->assertSame(AbstractEntity::class, $adapter->getEntityClass());
26
        $this->assertSame($objectManager, $adapter->getObjectManager());
27
    }
28
29
    public function testFindByUuidWithInvalidUuidReturnsNull()
30
    {
31
        $objectManager = $this->getMock(ObjectManager::class);
32
        $adapter       = new DoctrineAdapter(AbstractEntity::class, $objectManager);
33
34
        $this->assertNull($adapter->findByUuid('foobar'));
35
    }
36
}
37