Completed
Push — master ( 29a9e1...3152e3 )
by Benjamin
14:00 queued 11:53
created

UserTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testToString() 0 8 1
A testCreated() 0 9 1
A testActivated() 0 8 1
A getInstance() 0 4 1
1
<?php
2
3
namespace Alpixel\Bundle\UserBundle\Tests\Entity;
4
5
class UserTest extends \PHPUnit_Framework_TestCase
6
{
7
    public function testToString()
8
    {
9
        $user = $this->getInstance();
10
        $this->assertNull($user->__toString());
11
12
        $user->setUsername('Jean-Jacques');
13
        $this->assertEquals('Jean-Jacques', $user->__toString());
14
    }
15
16
    public function testCreated()
17
    {
18
        $user = $this->getInstance();
19
        $this->assertNotNull($user->getCreated());
20
        $this->assertEquals(new \DateTime('now'), $user->getCreated());
21
22
        $user->setCreated(new \DateTime('yesterday'));
23
        $this->assertEquals(new \DateTime('yesterday'), $user->getCreated());
24
    }
25
26
    public function testActivated()
27
    {
28
        $user = $this->getInstance();
29
        $this->assertFalse($user->getActivated());
30
31
        $user->setActivated(true);
32
        $this->assertEquals(true, $user->getActivated());
33
    }
34
35
    public function getInstance()
36
    {
37
        return $this->getMockForAbstractClass('Alpixel\Bundle\UserBundle\Entity\User');
38
    }
39
}
40