These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\AdminBundle\Tests\Entity; |
||
4 | |||
5 | use Doctrine\Common\Collections\ArrayCollection; |
||
6 | |||
7 | use FOS\UserBundle\Model\GroupInterface; |
||
8 | |||
9 | use Kunstmaan\AdminBundle\Entity\User; |
||
10 | |||
11 | /** |
||
12 | * Generated by PHPUnit_SkeletonGenerator on 2012-09-04 at 16:54:04. |
||
13 | */ |
||
14 | class UserTest extends \PHPUnit_Framework_TestCase |
||
15 | { |
||
16 | /** |
||
17 | * @var User |
||
18 | */ |
||
19 | protected $object; |
||
20 | |||
21 | /** |
||
22 | * Sets up the fixture, for example, opens a network connection. |
||
23 | * This method is called before a test is executed. |
||
24 | */ |
||
25 | protected function setUp() |
||
26 | { |
||
27 | $this->object = new User(); |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * Tears down the fixture, for example, closes a network connection. |
||
32 | * This method is called after a test is executed. |
||
33 | */ |
||
34 | protected function tearDown() |
||
35 | { |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * @covers Kunstmaan\AdminBundle\Entity\User::__construct |
||
40 | */ |
||
41 | public function test__construct() |
||
42 | { |
||
43 | $object = new User(); |
||
44 | $object->setId(1); |
||
45 | $this->assertEquals(1, $object->getId()); |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * @covers Kunstmaan\AdminBundle\Entity\User::getId |
||
50 | * @covers Kunstmaan\AdminBundle\Entity\User::setId |
||
51 | */ |
||
52 | public function testGetSetId() |
||
53 | { |
||
54 | $this->object->setId(3); |
||
55 | $this->assertEquals(3, $this->object->getId()); |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * @covers Kunstmaan\AdminBundle\Entity\User::getGroupIds |
||
60 | */ |
||
61 | public function testGetGroupIds() |
||
62 | { |
||
63 | $group1 = $this->getMock('FOS\UserBundle\Model\GroupInterface'); |
||
0 ignored issues
–
show
|
|||
64 | $group1 |
||
65 | ->expects($this->once()) |
||
66 | ->method('getId') |
||
67 | ->will($this->returnValue(1)); |
||
68 | |||
69 | $group2 = $this->getMock('FOS\UserBundle\Model\GroupInterface'); |
||
0 ignored issues
–
show
The method
PHPUnit_Framework_TestCase::getMock() has been deprecated with message: Method deprecated since Release 5.4.0; use createMock() or getMockBuilder() instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.
Loading history...
|
|||
70 | $group2 |
||
71 | ->expects($this->once()) |
||
72 | ->method('getId') |
||
73 | ->will($this->returnValue(2)); |
||
74 | |||
75 | /* @var $group1 GroupInterface */ |
||
76 | $this->object->addGroup($group1); |
||
77 | /* @var $group2 GroupInterface */ |
||
78 | $this->object->addGroup($group2); |
||
79 | |||
80 | $this->assertEquals(array(1, 2), $this->object->getGroupIds()); |
||
81 | } |
||
82 | |||
83 | /** |
||
84 | * @covers Kunstmaan\AdminBundle\Entity\User::getGroups |
||
85 | */ |
||
86 | public function testGetGroups() |
||
87 | { |
||
88 | /* @var $group1 GroupInterface */ |
||
89 | $group1 = $this->getMock('FOS\UserBundle\Model\GroupInterface'); |
||
0 ignored issues
–
show
The method
PHPUnit_Framework_TestCase::getMock() has been deprecated with message: Method deprecated since Release 5.4.0; use createMock() or getMockBuilder() instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.
Loading history...
|
|||
90 | /* @var $group2 GroupInterface */ |
||
91 | $group2 = $this->getMock('FOS\UserBundle\Model\GroupInterface'); |
||
0 ignored issues
–
show
The method
PHPUnit_Framework_TestCase::getMock() has been deprecated with message: Method deprecated since Release 5.4.0; use createMock() or getMockBuilder() instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.
Loading history...
|
|||
92 | $this->object->addGroup($group1); |
||
93 | $this->object->addGroup($group2); |
||
94 | |||
95 | $collection = new ArrayCollection(); |
||
96 | $collection->add($group1); |
||
97 | $collection->add($group2); |
||
98 | |||
99 | $this->assertEquals($collection, $this->object->getGroups()); |
||
100 | } |
||
101 | |||
102 | /** |
||
103 | * @covers Kunstmaan\AdminBundle\Entity\User::hasRole |
||
104 | */ |
||
105 | View Code Duplication | public function testHasRole() |
|
106 | { |
||
107 | $this->object->addRole('ROLE_CUSTOM'); |
||
108 | $this->assertTrue($this->object->hasRole('ROLE_CUSTOM')); |
||
109 | |||
110 | $this->object->removeRole('ROLE_CUSTOM'); |
||
111 | $this->assertFalse($this->object->hasRole('ROLE_CUSTOM')); |
||
112 | } |
||
113 | } |
||
114 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.