Completed
Pull Request — develop (#542)
by Mathias
09:01
created
module/Core/test/CoreTest/Entity/EntityTraitTest.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -122,9 +122,9 @@
 block discarded – undo
122 122
     public function testHasPropertyReturnsExpectedResults($target, $expects)
123 123
     {
124 124
         $modes = [EntityInterface::PROPERTY_FACILE,
125
-                  EntityInterface::PROPERTY_GETTER,
126
-                  EntityInterface::PROPERTY_SETTER,
127
-                  EntityInterface::PROPERTY_STRICT];
125
+                    EntityInterface::PROPERTY_GETTER,
126
+                    EntityInterface::PROPERTY_SETTER,
127
+                    EntityInterface::PROPERTY_STRICT];
128 128
 
129 129
         foreach ($modes  as $mode) {
130 130
             $actual = $target->hasProperty('testProperty', $mode);
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -47,19 +47,19 @@  discard block
 block discarded – undo
47 47
         $countable = new \ArrayObject(['not', 'empty']);
48 48
 
49 49
         return [
50
-            [ null, false ],
51
-            [ '', false ],
52
-            [ 'something', true],
53
-            [ 0, false ],
54
-            [ 1, true ],
55
-            [ false, false ],
56
-            [ true, true ],
57
-            [ [], false ],
58
-            [ ['not', 'empty'], true ],
59
-            [ new \stdClass(), true ],
60
-            [ $emptyCountable, false ],
61
-            [ $countable, true ],
62
-            [ self::$fileResource, true ],
50
+            [null, false],
51
+            ['', false],
52
+            ['something', true],
53
+            [0, false],
54
+            [1, true],
55
+            [false, false],
56
+            [true, true],
57
+            [[], false],
58
+            [['not', 'empty'], true],
59
+            [new \stdClass(), true],
60
+            [$emptyCountable, false],
61
+            [$countable, true],
62
+            [self::$fileResource, true],
63 63
 
64 64
         ];
65 65
     }
@@ -106,10 +106,10 @@  discard block
 block discarded – undo
106 106
         $setterTarget = new HasPropertyAndSetterTestTraitEntity();
107 107
         $strictTarget = new HasPropertyAndGetterAndSetterTestTraitEntity();
108 108
         return [
109
-            [ $facileTarget, [true, false ,false, false]],
110
-            [ $getterTarget, [true, true, false, false]],
111
-            [ $setterTarget, [true, false, true, false]],
112
-            [ $strictTarget, [true, true, true, true]],
109
+            [$facileTarget, [true, false, false, false]],
110
+            [$getterTarget, [true, true, false, false]],
111
+            [$setterTarget, [true, false, true, false]],
112
+            [$strictTarget, [true, true, true, true]],
113 113
         ];
114 114
     }
115 115
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         foreach ($modes  as $mode) {
130 130
             $actual = $target->hasProperty('testProperty', $mode);
131 131
             $expect = array_shift($expects);
132
-            $assert = 'assert' . ($expect ? 'true' : 'false');
132
+            $assert = 'assert'.($expect ? 'true' : 'false');
133 133
 
134 134
             $this->$assert($actual);
135 135
         }
Please login to merge, or discard this patch.
module/Core/test/CoreTest/Entity/AbstractEntityTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     public function testSettingInvalidAttributes()
52 52
     {
53 53
         $input = "myValue";
54
-        @$this->target->invalidAttribute=$input;
54
+        @$this->target->invalidAttribute = $input;
55 55
     }
56 56
 
57 57
     /**
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
     public function setValidAttribute($validAttribute)
72 72
     {
73
-        $this->validAttribute=$validAttribute;
73
+        $this->validAttribute = $validAttribute;
74 74
         return $this;
75 75
     }
76 76
 
Please login to merge, or discard this patch.
module/Core/test/CoreTest/Entity/PermissionsTest.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     public function testCloneCreatesNewResourceCollection()
65 65
     {
66 66
         $resource = $this->getMockBuilder('\Core\Entity\PermissionsResourceInterface')
67
-                         ->getMockForAbstractClass();
67
+                            ->getMockForAbstractClass();
68 68
 
69 69
         $target1 = new Permissions();
70 70
         $target1->grant($resource, Permissions::PERMISSION_ALL);
@@ -121,23 +121,23 @@  discard block
 block discarded – undo
121 121
         $allParams    = array($user, PermissionsInterface::PERMISSION_ALL);
122 122
 
123 123
         $target = $this->getMockBuilder('\Core\Entity\Permissions')->disableOriginalConstructor()
124
-                       ->setMethods(array('isGranted', 'grant', 'revoke'))->getMock();
124
+                        ->setMethods(array('isGranted', 'grant', 'revoke'))->getMock();
125 125
 
126 126
 
127 127
         $target->expects($this->exactly(4))
128
-               ->method('isGranted')
129
-               ->withConsecutive($viewParams, $changeParams, $noneParams, $allParams)
130
-               ->willReturn(null);
128
+                ->method('isGranted')
129
+                ->withConsecutive($viewParams, $changeParams, $noneParams, $allParams)
130
+                ->willReturn(null);
131 131
 
132 132
         $target->expects($this->exactly(4))
133
-               ->method('grant')
134
-               ->withConsecutive($viewParams, $changeParams, $noneParams, $allParams)
135
-               ->willReturn(null);
133
+                ->method('grant')
134
+                ->withConsecutive($viewParams, $changeParams, $noneParams, $allParams)
135
+                ->willReturn(null);
136 136
 
137 137
         $target->expects($this->exactly(4))
138
-               ->method('revoke')
139
-               ->withConsecutive($viewParams, $changeParams, $noneParams, $allParams)
140
-               ->willReturn(null);
138
+                ->method('revoke')
139
+                ->withConsecutive($viewParams, $changeParams, $noneParams, $allParams)
140
+                ->willReturn(null);
141 141
 
142 142
         /* Test starts here */
143 143
 
@@ -167,11 +167,11 @@  discard block
 block discarded – undo
167 167
         $target   = new Permissions();
168 168
 
169 169
         foreach (array(
170
-                     PermissionsInterface::PERMISSION_VIEW   => array(true, false, false, false),
171
-                     PermissionsInterface::PERMISSION_CHANGE => array(true, true, true, false),
172
-                     PermissionsInterface::PERMISSION_ALL    => array(true, true, true, false),
173
-                     PermissionsInterface::PERMISSION_NONE   => array(false, false, false, true),
174
-                 ) as $perm => $expected
170
+                        PermissionsInterface::PERMISSION_VIEW   => array(true, false, false, false),
171
+                        PermissionsInterface::PERMISSION_CHANGE => array(true, true, true, false),
172
+                        PermissionsInterface::PERMISSION_ALL    => array(true, true, true, false),
173
+                        PermissionsInterface::PERMISSION_NONE   => array(false, false, false, true),
174
+                    ) as $perm => $expected
175 175
         ) {
176 176
             $target->grant($resource, $perm);
177 177
             $this->assertEquals($expected[0], $target->isGranted($resource, PermissionsInterface::PERMISSION_VIEW));
@@ -302,20 +302,20 @@  discard block
 block discarded – undo
302 302
     public function testGrantWorksWhenPassingPermissionsResourceInterfaces()
303 303
     {
304 304
         $resource = $this->getMockBuilder('\Core\Entity\PermissionsResourceInterface')
305
-                         ->getMockForAbstractClass();
305
+                            ->getMockForAbstractClass();
306 306
 
307 307
         $resource->expects($this->any())
308
-                 ->method('getPermissionsResourceId')->willReturn('resource');
308
+                    ->method('getPermissionsResourceId')->willReturn('resource');
309 309
 
310 310
         $userIds1 = array('user1', 'user2');
311 311
         $userIds2 = array('view' => array('user1', 'user2'), 'all' => array('user3', 'user4'));
312 312
         $resource->expects($this->exactly(4))
313
-                 ->method('getPermissionsUserIds')
314
-                 ->will($this->onConsecutiveCalls(
315
-                     $userIds1,
316
-                     $userIds2,
317
-                     array(),
318
-                     null
313
+                    ->method('getPermissionsUserIds')
314
+                    ->will($this->onConsecutiveCalls(
315
+                        $userIds1,
316
+                        $userIds2,
317
+                        array(),
318
+                        null
319 319
                         ));
320 320
 
321 321
 
@@ -383,9 +383,9 @@  discard block
 block discarded – undo
383 383
 
384 384
         /* @var $target \Core\Entity\PermissionsInterface|\PHPUnit_Framework_MockObject_MockObject */
385 385
         $target = $this->getMockBuilder('\Core\Entity\Permissions')
386
-                       ->disableOriginalConstructor()
387
-                       ->setMethods(array('grant', 'isAssigned'))
388
-                       ->getMock();
386
+                        ->disableOriginalConstructor()
387
+                        ->setMethods(array('grant', 'isAssigned'))
388
+                        ->getMock();
389 389
 
390 390
         if (PermissionsInterface::PERMISSION_NONE == $perm) {
391 391
             $target->expects($this->never())->method('isAssigned');
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
                 : PermissionsInterface::PERMISSION_NONE;
401 401
 
402 402
             $target->expects($this->once())->method('grant')->with($resource, $expPerm, $build)
403
-                   ->will($this->returnSelf());
403
+                    ->will($this->returnSelf());
404 404
         }
405 405
 
406 406
         /* Test start here */
@@ -455,11 +455,11 @@  discard block
 block discarded – undo
455 455
         }
456 456
 
457 457
         foreach (array(
458
-                     PermissionsInterface::PERMISSION_NONE,
459
-                     PermissionsInterface::PERMISSION_VIEW,
460
-                     PermissionsInterface::PERMISSION_CHANGE,
461
-                     PermissionsInterface::PERMISSION_ALL
462
-                 ) as $i => $perm
458
+                        PermissionsInterface::PERMISSION_NONE,
459
+                        PermissionsInterface::PERMISSION_VIEW,
460
+                        PermissionsInterface::PERMISSION_CHANGE,
461
+                        PermissionsInterface::PERMISSION_ALL
462
+                    ) as $i => $perm
463 463
         ) {
464 464
             $this->assertEquals($expected[$i], $target->isGranted($user, $perm));
465 465
         }
@@ -476,13 +476,13 @@  discard block
 block discarded – undo
476 476
     public function testClear()
477 477
     {
478 478
         $resource = $this->getMockBuilder('\Core\Entity\PermissionsResourceInterface')
479
-                         ->getMockForAbstractClass();
479
+                            ->getMockForAbstractClass();
480 480
 
481 481
         $resource->expects($this->any())
482
-                 ->method('getPermissionsResourceId')->willReturn('resource');
482
+                    ->method('getPermissionsResourceId')->willReturn('resource');
483 483
 
484 484
         $resource->expects($this->exactly(1))->method('getPermissionsUserIds')
485
-                 ->willReturn(array('test'));
485
+                    ->willReturn(array('test'));
486 486
 
487 487
         $target = new Permissions();
488 488
         $target->grant('test', Permissions::PERMISSION_ALL);
@@ -516,13 +516,13 @@  discard block
 block discarded – undo
516 516
     public function testInherit()
517 517
     {
518 518
         $resource = $this->getMockBuilder('\Core\Entity\PermissionsResourceInterface')
519
-                         ->getMockForAbstractClass();
519
+                            ->getMockForAbstractClass();
520 520
 
521 521
         $resource->expects($this->any())
522
-                 ->method('getPermissionsResourceId')->willReturn('resource');
522
+                    ->method('getPermissionsResourceId')->willReturn('resource');
523 523
 
524 524
         $resource->expects($this->any())->method('getPermissionsUserIds')
525
-                 ->willReturn(array('test'));
525
+                    ->willReturn(array('test'));
526 526
 
527 527
         $target1 = new Permissions();
528 528
         $target2 = new Permissions();
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
     public function testGetResourcesReturnsCollectionOfResources()
619 619
     {
620 620
         $resource = $this->getMockBuilder('\Core\Entity\PermissionsResourceInterface')
621
-                         ->getMockForAbstractClass();
621
+                            ->getMockForAbstractClass();
622 622
 
623 623
         $target = new Permissions();
624 624
         $target->grant($resource, PermissionsInterface::PERMISSION_ALL);
@@ -641,13 +641,13 @@  discard block
 block discarded – undo
641 641
         $grantedResource->expects($this->atLeastOnce())
642 642
                         ->method('getPermissionsUserIds')
643 643
                         ->will($this->onConsecutiveCalls(array(
644
-                                                             'all'  => array('user1', 'user2'),
645
-                                                             'view' => array('popel', 'dopel'),
646
-                                                         ), array('all' => array('user3'))));
644
+                                                                'all'  => array('user1', 'user2'),
645
+                                                                'view' => array('popel', 'dopel'),
646
+                                                            ), array('all' => array('user3'))));
647 647
         $grantedResource->method('getPermissionsResourceId')->willReturn('grantResource');
648 648
 
649 649
         $ungrantedResource = $this->getMockBuilder('\Core\Entity\PermissionsResourceInterface')
650
-                                  ->getMockForAbstractClass();
650
+                                    ->getMockForAbstractClass();
651 651
         $ungrantedResource->method('getPermissionsResourceId')->willReturn('ungrant');
652 652
 
653 653
         $target = new Permissions();
Please login to merge, or discard this patch.
module/Core/test/CoreTest/Entity/TimelineTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,10 +34,10 @@
 block discarded – undo
34 34
     public function propertiesProvider()
35 35
     {
36 36
         return [
37
-            ['date',[
37
+            ['date', [
38 38
                 'value' => new \DateTime(),
39 39
                 'default' => new \DateTime(),
40
-                'default_assert' => function ($v, $return) {
40
+                'default_assert' => function($v, $return) {
41 41
                     $date = new \DateTime();
42 42
                     $this->assertEquals(
43 43
                         $date->getTimestamp(),
Please login to merge, or discard this patch.
module/Core/test/CoreTest/Entity/PermissionsAwareTraitTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,23 +38,23 @@
 block discarded – undo
38 38
     public function propertiesProvider()
39 39
     {
40 40
         return [
41
-            [ 'permissions', [
41
+            ['permissions', [
42 42
                 'default' => new Permissions('Test/TestEntity'),
43 43
                 'value'   => new Permissions('Test')
44 44
 
45 45
             ]],
46
-            [ 'permissions', [
46
+            ['permissions', [
47 47
                 'default' => new Permissions(PermissionsAwareEntityWithPermissionsType::TYPE),
48 48
                 'value' => false,
49 49
                 'ignore_setter' => true,
50 50
                 'ignore_getter' => true,
51 51
 
52 52
             ]],
53
-            [ 'permissions', [
53
+            ['permissions', [
54 54
                 'default' => new Permissions(PermissionsAwareEntityWithSetupPermissions::TYPE),
55 55
                 'value' => false,
56 56
                 'ignore_setter' => true, 'ignore_getter' => true,
57
-                'post' => function () {
57
+                'post' => function() {
58 58
                     $this->assertTrue($this->target->setupPermissionsCalled);
59 59
                 },
60 60
             ]]
Please login to merge, or discard this patch.
module/Core/test/CoreTest/Entity/Tree/AttachedLeafsTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
         'as_reflection' => true,
38 38
     ];
39 39
 
40
-    private $inheritance = [ AbstractLeafs::class, IdentifiableEntityInterface::class ];
40
+    private $inheritance = [AbstractLeafs::class, IdentifiableEntityInterface::class];
41 41
 
42
-    private $traits = [ IdentifiableEntityTrait::class ];
42
+    private $traits = [IdentifiableEntityTrait::class];
43 43
 }
Please login to merge, or discard this patch.
module/Core/test/CoreTest/Entity/Tree/NodeTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
         '@testValueFilter' => false,
46 46
     ];
47 47
 
48
-    private $inheritance = [ NodeInterface::class ];
48
+    private $inheritance = [NodeInterface::class];
49 49
 
50
-    private $traits = [ EntityTrait::class, IdentifiableEntityTrait::class ];
50
+    private $traits = [EntityTrait::class, IdentifiableEntityTrait::class];
51 51
 
52 52
     public function propertiesProvider()
53 53
     {
@@ -56,16 +56,16 @@  discard block
 block discarded – undo
56 56
             ['name', 'testName'],
57 57
             ['value', ['value' => '', 'setter_exception' => ['\InvalidArgumentException', 'Value must not be empty']]],
58 58
             ['value', 'testValue'],
59
-            ['value', ['pre' => function () {
59
+            ['value', ['pre' => function() {
60 60
                 $this->target->setName('test Name');
61 61
             }, 'value' => '', 'expect' => 'test_name']],
62
-            ['value', ['pre' => function () {
62
+            ['value', ['pre' => function() {
63 63
                 $this->target->setName('test-Name');
64 64
             }, 'value' => '', 'expect' => 'test_name']],
65
-            ['value', ['pre' => function () {
65
+            ['value', ['pre' => function() {
66 66
                 $this->target->setName('testName');
67 67
             }, 'value' => '', 'expect' => 'testname']],
68
-            ['value', ['pre' => function () {
68
+            ['value', ['pre' => function() {
69 69
                 $this->target->setName('test Name');
70 70
             }, 'ignore_setter' => true, 'value' => 'test_name']],
71 71
             ['priority', 12],
Please login to merge, or discard this patch.
module/Core/test/CoreTest/Entity/Tree/EmbeddedLeafsTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,5 +31,5 @@
 block discarded – undo
31 31
 
32 32
     private $target = EmbeddedLeafs::class;
33 33
 
34
-    private $inheritance = [ AbstractLeafs::class ];
34
+    private $inheritance = [AbstractLeafs::class];
35 35
 }
Please login to merge, or discard this patch.
module/Core/test/CoreTest/Entity/FileEntityTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
     public function testSetGetName()
54 54
     {
55
-        $name="test.jpg";
55
+        $name = "test.jpg";
56 56
         $this->target->setName($name);
57 57
         $this->assertSame($this->target->getName(), $name);
58 58
     }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
     public function testGetDateUploaded()
109 109
     {
110
-        $input= new \DateTime("2016-01-02");
110
+        $input = new \DateTime("2016-01-02");
111 111
         $this->target->setDateUploaded($input);
112 112
         $this->assertEquals($this->target->getDateUploaded(), $input);
113 113
     }
Please login to merge, or discard this patch.