UserTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 12 1
A tearDown() 0 6 1
A findAll() 0 6 1
A findById() 0 6 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace User\Tests\Repository;
5
6
use Doctrine\Common\Annotations\AnnotationReader;
7
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
8
use Doctrine\Tests\OrmTestCase;
9
use User\Entity\User;
10
11
/**
12
 * @author Thiago Paes <[email protected]>
13
 */
14
class UserTest extends OrmTestCase
15
{
16
    /**
17
     * @var User
18
     */
19
    protected $obj;
20
21
    /**
22
     * @var \Doctrine\ORM\EntityManager
23
     */
24
    private $em;
25
26
    /**
27
     * Bootstrap
28
     */
29
    public function setUp()
30
    {
31
        parent::setUp();
32
33
        $reader = new AnnotationReader();
34
        $metadataDriver = new AnnotationDriver($reader, User::class);
35
36
        $this->em = $this->_getTestEntityManager();
37
        $this->em->getConfiguration()->setMetadataDriverImpl($metadataDriver);
38
39
        $this->obj = $this->em->getRepository(User::class);
40
    }
41
42
    /**
43
     * Shutdown
44
     */
45
    public function tearDown()
46
    {
47
        $this->obj = null;
48
49
        parent::tearDown();
50
    }
51
52
    /**
53
     * @test
54
     * @covers \User\Repository\User::findAll
55
     */
56
    public function findAll()
57
    {
58
        $result = $this->obj->findAll();
0 ignored issues
show
Bug introduced by
The method findAll() does not seem to exist on object<User\Entity\User>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
59
60
        $this->assertTrue(is_array($result));
61
    }
62
63
    /**
64
     * @test
65
     * @covers \User\Repository\User::findById
66
     */
67
    public function findById()
68
    {
69
        $result = $this->obj->findById(1);
0 ignored issues
show
Bug introduced by
The method findById() does not seem to exist on object<User\Entity\User>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
70
71
        $this->assertTrue(is_object($result));
72
    }
73
}
74