@@ -43,7 +43,7 @@ |
||
43 | 43 | '@testSetImagesWithPermissions' => ['mock' => ['clear' => 1, 'set' => 0, 'setPermissions']], |
44 | 44 | ]; |
45 | 45 | |
46 | - private $inheritance = [ ImageSetInterface::class ]; |
|
46 | + private $inheritance = [ImageSetInterface::class]; |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * @covers ::__construct |
@@ -30,7 +30,7 @@ |
||
30 | 30 | |
31 | 31 | private $target = Image::class; |
32 | 32 | |
33 | - private $inheritance = [ FileEntity::class, ImageInterface::class ]; |
|
33 | + private $inheritance = [FileEntity::class, ImageInterface::class]; |
|
34 | 34 | |
35 | - private $traits = [ ImageTrait::class ]; |
|
35 | + private $traits = [ImageTrait::class]; |
|
36 | 36 | } |
37 | 37 | \ No newline at end of file |
@@ -26,19 +26,19 @@ |
||
26 | 26 | { |
27 | 27 | protected $target; |
28 | 28 | |
29 | - public function setUp(){ |
|
29 | + public function setUp() { |
|
30 | 30 | $this->target = new ConcreteIdentifiableHydratorAwareEntity(); |
31 | 31 | } |
32 | 32 | |
33 | - public function testSetGetHydrator(){ |
|
33 | + public function testSetGetHydrator() { |
|
34 | 34 | $input = new EntityHydrator(); |
35 | 35 | $this->target->setHydrator($input); |
36 | - $this->assertSame($this->target->getHydrator(),$input); |
|
36 | + $this->assertSame($this->target->getHydrator(), $input); |
|
37 | 37 | } |
38 | 38 | |
39 | - public function testSetGetIdByMethod(){ |
|
39 | + public function testSetGetIdByMethod() { |
|
40 | 40 | $input = new EntityHydrator(); |
41 | - $this->assertEquals($this->target->getHydrator(),$input); |
|
41 | + $this->assertEquals($this->target->getHydrator(), $input); |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 |
@@ -206,8 +206,8 @@ |
||
206 | 206 | public function provideTestCreateAttachedEntityData() |
207 | 207 | { |
208 | 208 | return [ |
209 | - ['EntityClass' ], |
|
210 | - ['EntityClass', 'testkey' ], |
|
209 | + ['EntityClass'], |
|
210 | + ['EntityClass', 'testkey'], |
|
211 | 211 | ['EntityClass', ['param' => 'value']], |
212 | 212 | ['EntityClass', ['param' => 'value'], 'testkey'], |
213 | 213 | ]; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | public function testCloneCreatesNewResourceCollection() |
63 | 63 | { |
64 | 64 | $resource = $this->getMockBuilder('\Core\Entity\PermissionsResourceInterface') |
65 | - ->getMockForAbstractClass(); |
|
65 | + ->getMockForAbstractClass(); |
|
66 | 66 | |
67 | 67 | $target1 = new Permissions(); |
68 | 68 | $target1->grant($resource, Permissions::PERMISSION_ALL); |
@@ -119,23 +119,23 @@ discard block |
||
119 | 119 | $allParams = array($user, PermissionsInterface::PERMISSION_ALL); |
120 | 120 | |
121 | 121 | $target = $this->getMockBuilder('\Core\Entity\Permissions')->disableOriginalConstructor() |
122 | - ->setMethods(array('isGranted', 'grant', 'revoke'))->getMock(); |
|
122 | + ->setMethods(array('isGranted', 'grant', 'revoke'))->getMock(); |
|
123 | 123 | |
124 | 124 | |
125 | 125 | $target->expects($this->exactly(4)) |
126 | - ->method('isGranted') |
|
127 | - ->withConsecutive($viewParams, $changeParams, $noneParams, $allParams) |
|
128 | - ->willReturn(null); |
|
126 | + ->method('isGranted') |
|
127 | + ->withConsecutive($viewParams, $changeParams, $noneParams, $allParams) |
|
128 | + ->willReturn(null); |
|
129 | 129 | |
130 | 130 | $target->expects($this->exactly(4)) |
131 | - ->method('grant') |
|
132 | - ->withConsecutive($viewParams, $changeParams, $noneParams, $allParams) |
|
133 | - ->willReturn(null); |
|
131 | + ->method('grant') |
|
132 | + ->withConsecutive($viewParams, $changeParams, $noneParams, $allParams) |
|
133 | + ->willReturn(null); |
|
134 | 134 | |
135 | 135 | $target->expects($this->exactly(4)) |
136 | - ->method('revoke') |
|
137 | - ->withConsecutive($viewParams, $changeParams, $noneParams, $allParams) |
|
138 | - ->willReturn(null); |
|
136 | + ->method('revoke') |
|
137 | + ->withConsecutive($viewParams, $changeParams, $noneParams, $allParams) |
|
138 | + ->willReturn(null); |
|
139 | 139 | |
140 | 140 | /* Test starts here */ |
141 | 141 | |
@@ -165,11 +165,11 @@ discard block |
||
165 | 165 | $target = new Permissions(); |
166 | 166 | |
167 | 167 | foreach (array( |
168 | - PermissionsInterface::PERMISSION_VIEW => array(true, false, false, false), |
|
169 | - PermissionsInterface::PERMISSION_CHANGE => array(true, true, true, false), |
|
170 | - PermissionsInterface::PERMISSION_ALL => array(true, true, true, false), |
|
171 | - PermissionsInterface::PERMISSION_NONE => array(false, false, false, true), |
|
172 | - ) as $perm => $expected |
|
168 | + PermissionsInterface::PERMISSION_VIEW => array(true, false, false, false), |
|
169 | + PermissionsInterface::PERMISSION_CHANGE => array(true, true, true, false), |
|
170 | + PermissionsInterface::PERMISSION_ALL => array(true, true, true, false), |
|
171 | + PermissionsInterface::PERMISSION_NONE => array(false, false, false, true), |
|
172 | + ) as $perm => $expected |
|
173 | 173 | ) { |
174 | 174 | |
175 | 175 | $target->grant($resource, $perm); |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | $target->grant($resource, PermissionsInterface::PERMISSION_VIEW, false); |
276 | 276 | |
277 | 277 | $this->assertFalse($target->isGranted($user1, PermissionsInterface::PERMISSION_VIEW), |
278 | - 'Disable build of permissions test failed!'); |
|
278 | + 'Disable build of permissions test failed!'); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | /** |
@@ -300,17 +300,17 @@ discard block |
||
300 | 300 | public function testGrantWorksWhenPassingPermissionsResourceInterfaces() |
301 | 301 | { |
302 | 302 | $resource = $this->getMockBuilder('\Core\Entity\PermissionsResourceInterface') |
303 | - ->getMockForAbstractClass(); |
|
303 | + ->getMockForAbstractClass(); |
|
304 | 304 | |
305 | 305 | $resource->expects($this->any()) |
306 | - ->method('getPermissionsResourceId')->willReturn('resource'); |
|
306 | + ->method('getPermissionsResourceId')->willReturn('resource'); |
|
307 | 307 | |
308 | 308 | $userIds1 = array('user1', 'user2'); |
309 | 309 | $userIds2 = array('view' => array('user1', 'user2'), 'all' => array('user3', 'user4')); |
310 | 310 | $resource->expects($this->exactly(4)) |
311 | - ->method('getPermissionsUserIds') |
|
312 | - ->will($this->onConsecutiveCalls( |
|
313 | - $userIds1, $userIds2, array(), null |
|
311 | + ->method('getPermissionsUserIds') |
|
312 | + ->will($this->onConsecutiveCalls( |
|
313 | + $userIds1, $userIds2, array(), null |
|
314 | 314 | )); |
315 | 315 | |
316 | 316 | |
@@ -378,9 +378,9 @@ discard block |
||
378 | 378 | |
379 | 379 | /* @var $target \Core\Entity\PermissionsInterface|\PHPUnit_Framework_MockObject_MockObject */ |
380 | 380 | $target = $this->getMockBuilder('\Core\Entity\Permissions') |
381 | - ->disableOriginalConstructor() |
|
382 | - ->setMethods(array('grant', 'isAssigned')) |
|
383 | - ->getMock(); |
|
381 | + ->disableOriginalConstructor() |
|
382 | + ->setMethods(array('grant', 'isAssigned')) |
|
383 | + ->getMock(); |
|
384 | 384 | |
385 | 385 | if (PermissionsInterface::PERMISSION_NONE == $perm) { |
386 | 386 | $target->expects($this->never())->method('isAssigned'); |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | : PermissionsInterface::PERMISSION_NONE; |
396 | 396 | |
397 | 397 | $target->expects($this->once())->method('grant')->with($resource, $expPerm, $build) |
398 | - ->will($this->returnSelf()); |
|
398 | + ->will($this->returnSelf()); |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | /* Test start here */ |
@@ -451,11 +451,11 @@ discard block |
||
451 | 451 | } |
452 | 452 | |
453 | 453 | foreach (array( |
454 | - PermissionsInterface::PERMISSION_NONE, |
|
455 | - PermissionsInterface::PERMISSION_VIEW, |
|
456 | - PermissionsInterface::PERMISSION_CHANGE, |
|
457 | - PermissionsInterface::PERMISSION_ALL |
|
458 | - ) as $i => $perm |
|
454 | + PermissionsInterface::PERMISSION_NONE, |
|
455 | + PermissionsInterface::PERMISSION_VIEW, |
|
456 | + PermissionsInterface::PERMISSION_CHANGE, |
|
457 | + PermissionsInterface::PERMISSION_ALL |
|
458 | + ) as $i => $perm |
|
459 | 459 | ) { |
460 | 460 | $this->assertEquals($expected[$i], $target->isGranted($user, $perm)); |
461 | 461 | } |
@@ -472,13 +472,13 @@ discard block |
||
472 | 472 | public function testClear() |
473 | 473 | { |
474 | 474 | $resource = $this->getMockBuilder('\Core\Entity\PermissionsResourceInterface') |
475 | - ->getMockForAbstractClass(); |
|
475 | + ->getMockForAbstractClass(); |
|
476 | 476 | |
477 | 477 | $resource->expects($this->any()) |
478 | - ->method('getPermissionsResourceId')->willReturn('resource'); |
|
478 | + ->method('getPermissionsResourceId')->willReturn('resource'); |
|
479 | 479 | |
480 | 480 | $resource->expects($this->exactly(1))->method('getPermissionsUserIds') |
481 | - ->willReturn(array('test')); |
|
481 | + ->willReturn(array('test')); |
|
482 | 482 | |
483 | 483 | $target = new Permissions(); |
484 | 484 | $target->grant('test', Permissions::PERMISSION_ALL); |
@@ -513,13 +513,13 @@ discard block |
||
513 | 513 | { |
514 | 514 | |
515 | 515 | $resource = $this->getMockBuilder('\Core\Entity\PermissionsResourceInterface') |
516 | - ->getMockForAbstractClass(); |
|
516 | + ->getMockForAbstractClass(); |
|
517 | 517 | |
518 | 518 | $resource->expects($this->any()) |
519 | - ->method('getPermissionsResourceId')->willReturn('resource'); |
|
519 | + ->method('getPermissionsResourceId')->willReturn('resource'); |
|
520 | 520 | |
521 | 521 | $resource->expects($this->any())->method('getPermissionsUserIds') |
522 | - ->willReturn(array('test')); |
|
522 | + ->willReturn(array('test')); |
|
523 | 523 | |
524 | 524 | $target1 = new Permissions(); |
525 | 525 | $target2 = new Permissions(); |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | public function testGetResourcesReturnsCollectionOfResources() |
618 | 618 | { |
619 | 619 | $resource = $this->getMockBuilder('\Core\Entity\PermissionsResourceInterface') |
620 | - ->getMockForAbstractClass(); |
|
620 | + ->getMockForAbstractClass(); |
|
621 | 621 | |
622 | 622 | $target = new Permissions(); |
623 | 623 | $target->grant($resource, PermissionsInterface::PERMISSION_ALL); |
@@ -640,13 +640,13 @@ discard block |
||
640 | 640 | $grantedResource->expects($this->atLeastOnce()) |
641 | 641 | ->method('getPermissionsUserIds') |
642 | 642 | ->will($this->onConsecutiveCalls(array( |
643 | - 'all' => array('user1', 'user2'), |
|
644 | - 'view' => array('popel', 'dopel'), |
|
645 | - ), array('all' => array('user3')))); |
|
643 | + 'all' => array('user1', 'user2'), |
|
644 | + 'view' => array('popel', 'dopel'), |
|
645 | + ), array('all' => array('user3')))); |
|
646 | 646 | $grantedResource->method('getPermissionsResourceId')->willReturn('grantResource'); |
647 | 647 | |
648 | 648 | $ungrantedResource = $this->getMockBuilder('\Core\Entity\PermissionsResourceInterface') |
649 | - ->getMockForAbstractClass(); |
|
649 | + ->getMockForAbstractClass(); |
|
650 | 650 | $ungrantedResource->method('getPermissionsResourceId')->willReturn('ungrant'); |
651 | 651 | |
652 | 652 | $target = new Permissions(); |
@@ -183,14 +183,14 @@ |
||
183 | 183 | public function provideRolePermissionsData() |
184 | 184 | { |
185 | 185 | return [ |
186 | - [ 'user', 'user', false, true ], |
|
187 | - [ 'recruiter', 'user', false, false ], |
|
188 | - [ 'all', 'irrelevant', false, true ], |
|
189 | - [ 'user', 'user', true, true ], |
|
190 | - [ 'recruiter', 'user', true, false], |
|
191 | - [ 'all', 'irrelevant', true, true ], |
|
192 | - [ 'testUser', null, true, true ], |
|
193 | - [ 'anonymous', null, true, false ], |
|
186 | + ['user', 'user', false, true], |
|
187 | + ['recruiter', 'user', false, false], |
|
188 | + ['all', 'irrelevant', false, true], |
|
189 | + ['user', 'user', true, true], |
|
190 | + ['recruiter', 'user', true, false], |
|
191 | + ['all', 'irrelevant', true, true], |
|
192 | + ['testUser', null, true, true], |
|
193 | + ['anonymous', null, true, false], |
|
194 | 194 | ]; |
195 | 195 | } |
196 | 196 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | protected $target; |
33 | 33 | |
34 | - public function setUp(){ |
|
34 | + public function setUp() { |
|
35 | 35 | $this->target = new FileEntity(); |
36 | 36 | } |
37 | 37 | |
@@ -42,20 +42,20 @@ discard block |
||
42 | 42 | $this->assertInstanceOf('\Core\Entity\AbstractIdentifiableEntity', $this->target); |
43 | 43 | } |
44 | 44 | |
45 | - public function testGetResourceId(){ |
|
46 | - $this->assertSame($this->target->getResourceId(),'Entity/File'); |
|
45 | + public function testGetResourceId() { |
|
46 | + $this->assertSame($this->target->getResourceId(), 'Entity/File'); |
|
47 | 47 | } |
48 | 48 | |
49 | - public function testSetGetName(){ |
|
50 | - $name="test.jpg"; |
|
49 | + public function testSetGetName() { |
|
50 | + $name = "test.jpg"; |
|
51 | 51 | $this->target->setName($name); |
52 | - $this->assertSame($this->target->getName(),$name); |
|
52 | + $this->assertSame($this->target->getName(), $name); |
|
53 | 53 | } |
54 | 54 | |
55 | - public function testSetGetUser(){ |
|
55 | + public function testSetGetUser() { |
|
56 | 56 | $user = new User(); |
57 | 57 | $this->target->setUser($user); |
58 | - $this->assertSame($this->target->getUser(),$user); |
|
58 | + $this->assertSame($this->target->getUser(), $user); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $this->assertStringEndsWith($unit, $target->getPrettySize($size)); |
75 | 75 | } |
76 | 76 | |
77 | - public function provideSize(){ |
|
77 | + public function provideSize() { |
|
78 | 78 | return [ |
79 | 79 | [10, '10'], |
80 | 80 | [10000, 'kB'], |
@@ -83,42 +83,42 @@ discard block |
||
83 | 83 | ]; |
84 | 84 | } |
85 | 85 | |
86 | - public function testSetGetMimeType(){ |
|
86 | + public function testSetGetMimeType() { |
|
87 | 87 | $mime = "image/gif"; |
88 | 88 | $this->target->setType($mime); |
89 | - $this->assertSame($this->target->getType(),$mime); |
|
89 | + $this->assertSame($this->target->getType(), $mime); |
|
90 | 90 | } |
91 | 91 | |
92 | - public function testGetDateUploadedWithoutSetting(){ |
|
92 | + public function testGetDateUploadedWithoutSetting() { |
|
93 | 93 | $this->assertEquals( |
94 | 94 | $this->target->getDateUploaded()->format('Y-m-d H:i:s'), |
95 | 95 | (new \DateTime())->format('Y-m-d H:i:s') |
96 | 96 | ); |
97 | 97 | } |
98 | 98 | |
99 | - public function testGetDateUploaded(){ |
|
100 | - $input= new \DateTime("2016-01-02"); |
|
99 | + public function testGetDateUploaded() { |
|
100 | + $input = new \DateTime("2016-01-02"); |
|
101 | 101 | $this->target->setDateUploaded($input); |
102 | - $this->assertEquals($this->target->getDateUploaded(),$input); |
|
102 | + $this->assertEquals($this->target->getDateUploaded(), $input); |
|
103 | 103 | } |
104 | 104 | |
105 | - public function testSetGetFile(){ |
|
105 | + public function testSetGetFile() { |
|
106 | 106 | $file = "test"; |
107 | 107 | $this->target->setFile($file); |
108 | - $this->assertSame($this->target->getFile(),$file); |
|
108 | + $this->assertSame($this->target->getFile(), $file); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
112 | 112 | * @dataProvider providePermissions |
113 | 113 | * @param $permissions |
114 | 114 | */ |
115 | - public function testGetPermissions($input){ |
|
115 | + public function testGetPermissions($input) { |
|
116 | 116 | $permissions = new Permissions($input); |
117 | 117 | $this->target->setPermissions($permissions); |
118 | - $this->assertEquals($this->target->getPermissions(),$permissions); |
|
118 | + $this->assertEquals($this->target->getPermissions(), $permissions); |
|
119 | 119 | } |
120 | 120 | |
121 | - public function providePermissions(){ |
|
121 | + public function providePermissions() { |
|
122 | 122 | return [ |
123 | 123 | [Permissions::PERMISSION_ALL], |
124 | 124 | [Permissions::PERMISSION_CHANGE], |
@@ -29,5 +29,5 @@ |
||
29 | 29 | |
30 | 30 | private $target = EmbeddedLeafs::class; |
31 | 31 | |
32 | - private $inheritance = [ AbstractLeafs::class ]; |
|
32 | + private $inheritance = [AbstractLeafs::class]; |
|
33 | 33 | } |
34 | 34 | \ No newline at end of file |
@@ -47,15 +47,15 @@ |
||
47 | 47 | ] |
48 | 48 | ]; |
49 | 49 | |
50 | - private $inheritance = [ LeafsInterface::class ]; |
|
50 | + private $inheritance = [LeafsInterface::class]; |
|
51 | 51 | |
52 | - private $traits = [ EntityTrait::class ]; |
|
52 | + private $traits = [EntityTrait::class]; |
|
53 | 53 | |
54 | 54 | public function propertiesProvider() |
55 | 55 | { |
56 | 56 | |
57 | 57 | return [ |
58 | - [ 'items', ['default' => new ArrayCollection(), 'value' => new \Doctrine\Common\Collections\ArrayCollection()]], |
|
58 | + ['items', ['default' => new ArrayCollection(), 'value' => new \Doctrine\Common\Collections\ArrayCollection()]], |
|
59 | 59 | ]; |
60 | 60 | } |
61 | 61 |
@@ -43,9 +43,9 @@ |
||
43 | 43 | '@testValueFilter' => false, |
44 | 44 | ]; |
45 | 45 | |
46 | - private $inheritance = [ NodeInterface::class ]; |
|
46 | + private $inheritance = [NodeInterface::class]; |
|
47 | 47 | |
48 | - private $traits = [ EntityTrait::class, IdentifiableEntityTrait::class ]; |
|
48 | + private $traits = [EntityTrait::class, IdentifiableEntityTrait::class]; |
|
49 | 49 | |
50 | 50 | public function propertiesProvider() |
51 | 51 | { |