DoctrineAdapterTest::testConstructor()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
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