UserTest::testToString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

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