Completed
Pull Request — develop (#521)
by Mathias
14:38
created
Organizations/test/OrganizationsTest/Mail/EmployeeInvitationFactoryTest.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
 
117 117
         $orgRep = $this->getMockBuilder('\Organizations\Repository\Organization')->disableOriginalConstructor()->getMock();
118 118
         $orgRep->expects($this->exactly(2))
119
-               ->method('findByUser')
120
-               ->withConsecutive(array('testOwner'), array('testUser'))
121
-               ->will($this->onConsecutiveCalls($ownerOrg, $userOrg));
119
+                ->method('findByUser')
120
+                ->withConsecutive(array('testOwner'), array('testUser'))
121
+                ->will($this->onConsecutiveCalls($ownerOrg, $userOrg));
122 122
 
123 123
 
124 124
         $ownerOrgRef = new OrganizationReference('testOwner', $orgRep);
@@ -135,37 +135,37 @@  discard block
 block discarded – undo
135 135
 
136 136
         $router = $this->getMockForAbstractClass(RouteStackInterface::class);
137 137
         $router->expects($this->once())
138
-               ->method('assemble')
139
-               ->with(array('action' => 'accept'),
140
-                      array('name' => 'lang/organizations/invite',
138
+                ->method('assemble')
139
+                ->with(array('action' => 'accept'),
140
+                        array('name' => 'lang/organizations/invite',
141 141
                             'query' => array('token' => $options['token'], 'organization' => $ownerOrg->getId()))
142
-               )
143
-               ->willReturn('testUrl');
142
+                )
143
+                ->willReturn('testUrl');
144 144
 
145 145
         $mailService = $this->getMockBuilder('\Core\Mail\MailService')->disableOriginalConstructor()->getMock();
146 146
 
147 147
         $services = $this->getMockBuilder('\Zend\ServiceManager\ServiceManager')->disableOriginalConstructor()->getMock();
148 148
 
149 149
         $services->expects($this->exactly(3))
150
-                 ->method('get')
151
-                 ->withConsecutive(
150
+                    ->method('get')
151
+                    ->withConsecutive(
152 152
                         array('AuthenticationService'),
153 153
                         array('Router'),
154 154
                         ['Core/MailService']
155
-                 )->will($this->onConsecutiveCalls($authService, $router, $mailService));
155
+                    )->will($this->onConsecutiveCalls($authService, $router, $mailService));
156 156
 
157 157
         $mailMock = new HTMLTemplateMessage(new \Zend\ServiceManager\ServiceManager());
158 158
         $translator = $this->getMockBuilder('\Zend\I18n\Translator\Translator')->disableOriginalConstructor()->getMock();
159 159
         $translator
160
-	        ->expects($this->any())
161
-	        ->method('translate')
162
-	        ->will($this->returnArgument(0));
160
+            ->expects($this->any())
161
+            ->method('translate')
162
+            ->will($this->returnArgument(0));
163 163
         $mailMock->setTranslator($translator);
164 164
         $mailService
165
-	        ->expects($this->once())
166
-	        ->method('get')
167
-	        ->with('htmltemplate')
168
-	        ->willReturn($mailMock);
165
+            ->expects($this->once())
166
+            ->method('get')
167
+            ->with('htmltemplate')
168
+            ->willReturn($mailMock);
169 169
 
170 170
 
171 171
         $target = new EmployeeInvitationFactory();
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -169,7 +169,7 @@
 block discarded – undo
169 169
 
170 170
 
171 171
         $target = new EmployeeInvitationFactory();
172
-        $mail = $target->__invoke($services,'irrelevant',$options);
172
+        $mail = $target->__invoke($services, 'irrelevant', $options);
173 173
 
174 174
 
175 175
         $vars = $mail->getVariables()->getArrayCopy();
Please login to merge, or discard this patch.
module/Organizations/test/OrganizationsTest/Entity/OrganizationTest.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -60,74 +60,74 @@  discard block
 block discarded – undo
60 60
         $parent = new Organization();
61 61
         $permissions = $this->createMock(Permissions::class);
62 62
         return [
63
-            [ 'externalId', '1234' ],
64
-            [ 'name', [ 'value'=> '', 'ignore_setter' => true] ],
65
-            [ 'name', [ 'pre' => 'setupGetName', 'value' => 'Test', 'ignore_setter' => true] ],
66
-            [ 'organizationName' , [
67
-                '@value' => [ '\Organizations\Entity\OrganizationName', [ 'Test' ] ],
63
+            ['externalId', '1234'],
64
+            ['name', ['value'=> '', 'ignore_setter' => true]],
65
+            ['name', ['pre' => 'setupGetName', 'value' => 'Test', 'ignore_setter' => true]],
66
+            ['organizationName', [
67
+                '@value' => ['\Organizations\Entity\OrganizationName', ['Test']],
68 68
                 'post' => 'organizationNamePostAsserts'
69 69
             ]],
70
-            [ 'organizationName', [
70
+            ['organizationName', [
71 71
                 'pre' => 'setupOrganizationName',
72
-                '@value' => [ '\Organizations\Entity\OrganizationName', [ 'TestNew' ] ],
72
+                '@value' => ['\Organizations\Entity\OrganizationName', ['TestNew']],
73 73
                 'post' => 'assertOrganizationNameCounter'
74 74
             ]],
75
-            [ 'permissions',[
75
+            ['permissions', [
76 76
                 'value' => $permissions
77 77
             ]],
78
-            [ 'image',[
78
+            ['image', [
79 79
                 'value' => new OrganizationImage()
80 80
             ]],
81
-            [ 'images',[
81
+            ['images', [
82 82
                 'value' => new ImageSet(),
83 83
             ]],
84
-            [ 'isDraft',[
84
+            ['isDraft', [
85 85
                 'default' => false,
86 86
                 'value' => true,
87 87
                 'getter_method' => 'isDraft'
88 88
             ]],
89
-            [ 'contact',[
89
+            ['contact', [
90 90
                 'value' => new OrganizationContact()
91 91
             ]],
92
-            [ 'description',[
92
+            ['description', [
93 93
                 'default' => null,
94 94
                 'value' => 'Some Description'
95 95
             ]],
96
-            [ 'parent',[
96
+            ['parent', [
97 97
                 'default' => null,
98 98
                 'value' => $parent,
99 99
             ]],
100
-            [ 'hiringOrganizations',[
100
+            ['hiringOrganizations', [
101 101
                 'default' => null,
102 102
             ]],
103 103
 
104
-            [ 'employees',[
104
+            ['employees', [
105 105
                 '@default' => ArrayCollection::class,
106 106
                 'value' => new ArrayCollection()
107 107
             ]],
108 108
 
109
-            [ 'jobs',[
109
+            ['jobs', [
110 110
                 'default' => null,
111 111
             ]],
112 112
 
113
-            [ 'user',[
113
+            ['user', [
114 114
                 'value' => new User()
115 115
             ]],
116 116
 
117
-            [ 'template',[
117
+            ['template', [
118 118
                 'value' => new Template(),
119 119
             ]],
120 120
 
121
-            [ 'workflowSettings',[
121
+            ['workflowSettings', [
122 122
                 'value' => new WorkflowSettings(),
123 123
             ]],
124 124
 
125
-            [ 'profileSetting',[
125
+            ['profileSetting', [
126 126
                 'value' => Organization::PROFILE_ALWAYS_ENABLE,
127 127
                 'default' => null,
128 128
             ]],
129 129
 
130
-            [ 'hydrator', [
130
+            ['hydrator', [
131 131
                 '@default' => EntityHydrator::class
132 132
             ]]
133 133
 
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
         $organization->setEmployees($employees);
177 177
 
178 178
         $organization->getEmployee($user);
179
-        $this->assertEquals($employee,$organization->getEmployee($user));
180
-        $this->assertEquals($employee,$organization->getEmployee($user->getId()));
179
+        $this->assertEquals($employee, $organization->getEmployee($user));
180
+        $this->assertEquals($employee, $organization->getEmployee($user->getId()));
181 181
         $this->assertNull($organization->getEmployee('foobar'));
182 182
         $this->assertEquals(
183 183
             [$employee],
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
                 ->toArray()
187 187
         );
188 188
 
189
-        $this->assertEquals(1,$organization->getEmployees()->count());
189
+        $this->assertEquals(1, $organization->getEmployees()->count());
190 190
         $organization->setParent($parent);
191 191
         $this->assertEquals(
192 192
             0,
@@ -199,12 +199,12 @@  discard block
 block discarded – undo
199 199
     {
200 200
         $image = new OrganizationImage();
201 201
         $images = new ImageSet();
202
-        $images->set(ImageSet::ORIGINAL,$image);
202
+        $images->set(ImageSet::ORIGINAL, $image);
203 203
 
204 204
         $organization = new Organization();
205 205
         $organization->setImages($images);
206 206
         $organization->removeImages();
207
-        $this->assertNotEquals($images,$organization->getImages());
207
+        $this->assertNotEquals($images, $organization->getImages());
208 208
         $this->assertNull($organization->getImages()->get(ImageSet::ORIGINAL));
209 209
     }
210 210
 
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
         $permissions = $this->createMock(Permissions::class);
300 300
         $permissions->expects($this->once())
301 301
             ->method('grant')
302
-            ->with($user,PermissionsInterface::PERMISSION_CHANGE,false)
302
+            ->with($user, PermissionsInterface::PERMISSION_CHANGE, false)
303 303
         ;
304 304
 
305 305
         $organization = new Organization();
Please login to merge, or discard this patch.
Organizations/test/OrganizationsTest/Entity/OrganizationReferenceTest.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
     public function testOrganizationReferenceImplementsInterfaces()
42 42
     {
43 43
         $target = $this->getMockBuilder('\Organizations\Entity\OrganizationReference')
44
-                       ->disableOriginalConstructor()
45
-                       ->getMock();
44
+                        ->disableOriginalConstructor()
45
+                        ->getMock();
46 46
 
47 47
         $this->assertInstanceOf('\Organizations\Entity\OrganizationReferenceInterface', $target);
48 48
         $this->assertInstanceOf('\Organizations\Entity\OrganizationInterface', $target);
@@ -59,21 +59,21 @@  discard block
 block discarded – undo
59 59
             $organization = new Organization();
60 60
 
61 61
             $repository = $this->getMockBuilder('\Organizations\Repository\Organization')
62
-                               ->disableOriginalConstructor()->getMock();
62
+                                ->disableOriginalConstructor()->getMock();
63 63
 
64 64
             $repository->expects($this->once())
65
-                       ->method('findByUser')
66
-                       ->with('1234')
67
-                       ->willReturn('owner' == $type ? $organization : null);
65
+                        ->method('findByUser')
66
+                        ->with('1234')
67
+                        ->willReturn('owner' == $type ? $organization : null);
68 68
 
69 69
             if ('owner' == $type) {
70 70
                 $repository->expects($this->never())
71
-                           ->method('findByEmployee');
71
+                            ->method('findByEmployee');
72 72
             } else {
73 73
                 $repository->expects($this->once())
74
-                           ->method('findByEmployee')
75
-                           ->with('1234')
76
-                           ->willReturn('employee' == $type ? $organization : null);
74
+                            ->method('findByEmployee')
75
+                            ->with('1234')
76
+                            ->willReturn('employee' == $type ? $organization : null);
77 77
             }
78 78
 
79 79
             $target = new OrganizationReference('1234', $repository);
@@ -196,8 +196,8 @@  discard block
 block discarded – undo
196 196
             [['setEmployees', 'getEmployees'], [[$emps], []], ['__self__', $emps]],
197 197
             ['getEmployee', ['4321'], null],
198 198
             [['setUser', 'getUser', 'getPermissionsUserIds'],
199
-                  [[$user], [], []],
200
-                  ['__self__', $user, [PermissionsInterface::PERMISSION_ALL => [$user->getId()]]]
199
+                    [[$user], [], []],
200
+                    ['__self__', $user, [PermissionsInterface::PERMISSION_ALL => [$user->getId()]]]
201 201
             ],
202 202
             ['getJobs', [], null],
203 203
             [['setPermissions', 'getPermissions'], [[$perms], []], ['__self__', $perms]],
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
             $args = array($args);
115 115
         }
116 116
 
117
-        for ($i=0,$c=count($func); $i<$c; $i+=1) {
117
+        for ($i = 0, $c = count($func); $i < $c; $i += 1) {
118 118
             $f = $func[$i];
119 119
             $a = $args[$i];
120 120
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
             $func = array($func); $args = array($args); $expected = array($expected);
142 142
         }
143 143
 
144
-        for ($i=0, $c=count($func); $i<$c; $i+=1) {
144
+        for ($i = 0, $c = count($func); $i < $c; $i += 1) {
145 145
             $f = $func[$i];
146 146
             $a = $args[$i];
147 147
             $e = $expected[$i];
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
         $perms = new Permissions();
172 172
         $contact = new OrganizationContact();
173 173
         $image = new OrganizationImage();
174
-        $externalId='myReference';
174
+        $externalId = 'myReference';
175 175
         $template = new Template();
176 176
         $template->setLabelBenefits('These are your Benefits');
177 177
         $workflowSettings = new WorkflowSettings();
Please login to merge, or discard this patch.
Organizations/test/OrganizationsTest/Entity/OrganizationImageTest.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 
50 50
     public function testGetResourceId()
51 51
     {
52
-       $this->assertSame($this->target->getResourceId(), 'Entity/OrganizationImage');
52
+        $this->assertSame($this->target->getResourceId(), 'Entity/OrganizationImage');
53 53
     }
54 54
 
55 55
     public function testGetUriWithAndWithoutFilename()
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,14 +54,14 @@
 block discarded – undo
54 54
 
55 55
     public function testGetUriWithAndWithoutFilename()
56 56
     {
57
-        $filename="My File.png";
57
+        $filename = "My File.png";
58 58
         $this->target->setName($filename);
59 59
         $this->assertSame($this->target->getUri(), '/file/Organizations.OrganizationImage/'.$this->target->getId().'/'.urlencode($this->target->getName()));
60 60
         $this->target->setName(null);
61 61
         $this->assertSame($this->target->getUri(), '/file/Organizations.OrganizationImage/'.$this->target->getId());
62 62
     }
63 63
 
64
-    public function testSetGetOrganization(){
64
+    public function testSetGetOrganization() {
65 65
         $organization = new Organization();
66 66
         $this->target->setOrganization($organization);
67 67
         $this->assertSame($this->target->getOrganization(), $organization);
Please login to merge, or discard this patch.
test/OrganizationsTest/Form/OrganizationDescriptionFieldsetTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      */
30 30
     protected $target;
31 31
 
32
-    public function setUp(){
32
+    public function setUp() {
33 33
         $this->target = new OrganizationsDescriptionFieldset();
34 34
         $this->target->init();
35 35
     }
@@ -39,16 +39,16 @@  discard block
 block discarded – undo
39 39
         $this->assertInstanceOf('Zend\Form\Fieldset', $this->target);
40 40
     }
41 41
 
42
-    public function testNameFormFields(){
43
-        $this->assertSame($this->target->getName(),"organization-description");
42
+    public function testNameFormFields() {
43
+        $this->assertSame($this->target->getName(), "organization-description");
44 44
         $this->assertTrue($this->target->has('description'));
45 45
     }
46 46
 
47
-    public function testGetInputFilterSpec(){
48
-        $this->assertSame($this->target->getInputFilterSpecification(),[]);
47
+    public function testGetInputFilterSpec() {
48
+        $this->assertSame($this->target->getInputFilterSpecification(), []);
49 49
     }
50 50
 
51
-    public function testGetHydrator(){
51
+    public function testGetHydrator() {
52 52
         $this->assertEquals($this->target->getHydrator(), new EntityHydrator());
53 53
     }
54 54
 
Please login to merge, or discard this patch.
module/Organizations/test/OrganizationsTest/Form/EmployeesFieldsetTest.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -86,11 +86,11 @@
 block discarded – undo
86 86
                 ->getMock();
87 87
 
88 88
         $target->expects($this->exactly(2))
89
-               ->method('add')
90
-               ->withConsecutive(
89
+                ->method('add')
90
+                ->withConsecutive(
91 91
                     array($expectAdd1),
92 92
                     array($expectAdd2)
93
-               );
93
+                );
94 94
 
95 95
         $target->init();
96 96
         $this->assertEquals('employees', $target->getName());
Please login to merge, or discard this patch.
module/Organizations/test/OrganizationsTest/Form/OrganizationTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,11 +36,11 @@
 block discarded – undo
36 36
         $this->assertInstanceOf('Organizations\Form\Organizations', $this->target);
37 37
     }
38 38
 
39
-    public function testName(){
40
-        $this->assertSame($this->target->getName(),'organization-form');
39
+    public function testName() {
40
+        $this->assertSame($this->target->getName(), 'organization-form');
41 41
     }
42 42
 
43 43
     public function testNumberOfField() {
44
-        $this->assertSame($this->target->count(),7);
44
+        $this->assertSame($this->target->count(), 7);
45 45
     }
46 46
 }
Please login to merge, or discard this patch.
test/OrganizationsTest/Form/OrganizationsProfileFieldsetTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
     public function testNameFormFields()
38 38
     {
39
-        $this->assertEquals('profile-setting',$this->target->getName());
39
+        $this->assertEquals('profile-setting', $this->target->getName());
40 40
         $this->assertTrue($this->target->has('profileSetting'));
41 41
     }
42 42
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         $this->assertTrue($this->target->allowObjectBinding(new Organization()));
51 51
     }
52 52
 
53
-    public function testGetHydrator(){
53
+    public function testGetHydrator() {
54 54
         $this->assertEquals($this->target->getHydrator(), new EntityHydrator());
55 55
     }
56 56
 }
Please login to merge, or discard this patch.
module/Organizations/test/OrganizationsTest/Form/EmployeeFieldsetTest.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -102,15 +102,15 @@
 block discarded – undo
102 102
                 ->getMock();
103 103
 
104 104
         $target->expects($this->exactly(4))
105
-               ->method('add')
106
-               ->withConsecutive(
105
+                ->method('add')
106
+                ->withConsecutive(
107 107
                     array($expectAdd1),
108 108
                     array($expectAdd2),
109 109
                     array($expectAdd3),
110 110
                     array($expectAdd4)
111 111
 
112 112
 
113
-               );
113
+                );
114 114
 
115 115
         $target->init();
116 116
     }
Please login to merge, or discard this patch.