Completed
Pull Request — develop (#521)
by Mathias
14:38
created
module/Auth/test/AuthTest/Controller/Plugin/UserSwitcherTest.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -205,13 +205,13 @@  discard block
 block discarded – undo
205 205
         $_SESSION = $oldSession;
206 206
         $this->assertTrue($this->target->switchUser('switchedUser'));
207 207
         $this->assertEquals(
208
-             [
209
-                 'isSwitchedUser' => true,
210
-                 'originalUser' => 'originalUser',
211
-                 'params' => [], 'ref' => '/some/ref',
212
-                 'session' => serialize($oldSession)
213
-             ],
214
-             $_SESSION[UserSwitcher::SESSION_NAMESPACE]->getArrayCopy()
208
+                [
209
+                    'isSwitchedUser' => true,
210
+                    'originalUser' => 'originalUser',
211
+                    'params' => [], 'ref' => '/some/ref',
212
+                    'session' => serialize($oldSession)
213
+                ],
214
+                $_SESSION[UserSwitcher::SESSION_NAMESPACE]->getArrayCopy()
215 215
         );
216 216
         $_SESSION = [];
217 217
     }
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
         $acl->expects($this->once())->method('setUser')->with($this->isInstanceOf(User::class));
236 236
 
237 237
         $user = $this->getMockBuilder(User::class)->disableOriginalConstructor()
238
-                     ->setMethods(['getId'])->getMock();
238
+                        ->setMethods(['getId'])->getMock();
239 239
         $user->expects($this->any())->method('getId')->willReturn('switchedUser');
240 240
 
241 241
         $this->target->switchUser($user, ['ref' => 'ref']);
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
     private $target = [
44 44
         UserSwitcher::class,
45 45
         'getSimpleAuthMock',
46
-        '@testInheritance' => [ 'as_reflection' => true ],
46
+        '@testInheritance' => ['as_reflection' => true],
47 47
         '@testInvokationProxiesToCorrectMethods' => [
48 48
             'args' => false,
49
-            'mock' => [ 'clear' => 1, 'switchUser' => ['with' => 'testUserId', 'count' => 1]],
49
+            'mock' => ['clear' => 1, 'switchUser' => ['with' => 'testUserId', 'count' => 1]],
50 50
         ],
51 51
         '@testClearRestoresOriginalUserAndClearsSession' => [
52 52
             'args' => 'getComplexAuthMock',
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         ],
63 63
     ];
64 64
 
65
-    private $inheritance = [ AbstractPlugin::class ];
65
+    private $inheritance = [AbstractPlugin::class];
66 66
 
67 67
     public function propertiesProvider()
68 68
     {
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
             ->disableOriginalConstructor()
108 108
             ->getMock();
109 109
 
110
-        return [ $auth ];
110
+        return [$auth];
111 111
     }
112 112
 
113 113
     private function getComplexAuthMock()
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
         $auth->expects($this->any())->method('getUser')->willReturn(new User());
134 134
 
135
-        return [ $auth ];
135
+        return [$auth];
136 136
     }
137 137
 
138 138
     public function testInvokationProxiesToCorrectMethods()
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
     public function returnReferenceProvider()
150 150
     {
151 151
         return [
152
-            [ null ], [ 'some/ref/uri' ],
152
+            [null], ['some/ref/uri'],
153 153
         ];
154 154
     }
155 155
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         $session = new Container(UserSwitcher::SESSION_NAMESPACE);
164 164
         $session->isSwitchedUser = true;
165 165
         $session->originalUser = 'switchedUser';
166
-        $oldSession      = [
166
+        $oldSession = [
167 167
             'oldSession' => true,
168 168
             'must'       => 'be same'
169 169
         ];
Please login to merge, or discard this patch.
module/Auth/test/AuthTest/Controller/PasswordControllerFunctionalTest.php 2 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
             ]));
44 44
 	    
45 45
         $manager = $this->getMockBuilder(Manager::class)
46
-	        ->disableOriginalConstructor()
47
-	        ->getMock()
48
-	    ;
46
+            ->disableOriginalConstructor()
47
+            ->getMock()
48
+        ;
49 49
         $hybridAuth = $this->getMockBuilder(\Hybrid_Auth::class)->disableOriginalConstructor()->getMock();
50 50
         $this->setMockToServiceLocator('repositories', $this->repositoriesMock);
51 51
         $this->setMockToServiceLocator('Organizations\ImageFileCache\Manager',$manager);
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
     public function testAccessWhenYouAreLogged()
63 63
     {
64
-	    /*$repository = $this->getMockBuilder(OrganizationImage::class)
64
+        /*$repository = $this->getMockBuilder(OrganizationImage::class)
65 65
 	                       ->disableOriginalConstructor()
66 66
 	                       ->getMock()
67 67
 	    ;
@@ -82,37 +82,37 @@  discard block
 block discarded – undo
82 82
         $this->assertContains('My password', $result);
83 83
     }
84 84
 	
85
-	public function testAccessWhenYouAreNotLoggedIn()
86
-	{
87
-		$this->dispatch(self::URL_MY_PASSWORD, Request::METHOD_GET);
85
+    public function testAccessWhenYouAreNotLoggedIn()
86
+    {
87
+        $this->dispatch(self::URL_MY_PASSWORD, Request::METHOD_GET);
88 88
 		
89
-		$result = $this->getResponse()->getContent();
89
+        $result = $this->getResponse()->getContent();
90 90
 		
91
-		$this->assertNotRedirect();
92
-		$this->assertResponseStatusCode(Response::STATUS_CODE_401);
93
-		$this->assertContains('Please authenticate yourself to proceed', $result);
94
-	}
91
+        $this->assertNotRedirect();
92
+        $this->assertResponseStatusCode(Response::STATUS_CODE_401);
93
+        $this->assertContains('Please authenticate yourself to proceed', $result);
94
+    }
95 95
 	
96
-	/**
97
-	 * Assert response status code
98
-	 *
99
-	 * @param int $code
100
-	 */
101
-	public function assertResponseStatusCode($code)
102
-	{
103
-		if ($this->useConsoleRequest) {
104
-			if (! in_array($code, [0, 1])) {
105
-				throw new \PHPUnit_Framework_ExpectationFailedException($this->createFailureMessage(
106
-					'Console status code assert value must be O (valid) or 1 (error)'
107
-				));
108
-			}
109
-		}
110
-		$match = $this->getResponseStatusCode();
111
-		if ($code != $match) {
112
-			throw new \PHPUnit_Framework_ExpectationFailedException($this->createFailureMessage(
113
-				sprintf('Failed asserting response code "%s", actual status code is "%s"', $code, $match)
114
-			));
115
-		}
116
-		$this->assertEquals($code, $match);
117
-	}
96
+    /**
97
+     * Assert response status code
98
+     *
99
+     * @param int $code
100
+     */
101
+    public function assertResponseStatusCode($code)
102
+    {
103
+        if ($this->useConsoleRequest) {
104
+            if (! in_array($code, [0, 1])) {
105
+                throw new \PHPUnit_Framework_ExpectationFailedException($this->createFailureMessage(
106
+                    'Console status code assert value must be O (valid) or 1 (error)'
107
+                ));
108
+            }
109
+        }
110
+        $match = $this->getResponseStatusCode();
111
+        if ($code != $match) {
112
+            throw new \PHPUnit_Framework_ExpectationFailedException($this->createFailureMessage(
113
+                sprintf('Failed asserting response code "%s", actual status code is "%s"', $code, $match)
114
+            ));
115
+        }
116
+        $this->assertEquals($code, $match);
117
+    }
118 118
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 
22 22
     public function setUp()
23 23
     {
24
-        $logDir = __DIR__ . '/../../../../../log/';
25
-        $errorLogFile = $logDir . 'error.log';
26
-        $yawikLogFile = $logDir . 'yawik.log';
24
+        $logDir = __DIR__.'/../../../../../log/';
25
+        $errorLogFile = $logDir.'error.log';
26
+        $yawikLogFile = $logDir.'yawik.log';
27 27
 
28 28
         if ((file_exists($errorLogFile) && !is_writable($errorLogFile))
29 29
             || (file_exists($yawikLogFile) && !is_writable($yawikLogFile))
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
             ->getMock();
40 40
         $this->repositoriesMock->expects($this->any())->method('get')
41 41
             ->will($this->returnValueMap([
42
-                [ 'Organizations/OrganizationImage', $orgImageRepo ]
42
+                ['Organizations/OrganizationImage', $orgImageRepo]
43 43
             ]));
44 44
 	    
45 45
         $manager = $this->getMockBuilder(Manager::class)
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	    ;
49 49
         $hybridAuth = $this->getMockBuilder(\Hybrid_Auth::class)->disableOriginalConstructor()->getMock();
50 50
         $this->setMockToServiceLocator('repositories', $this->repositoriesMock);
51
-        $this->setMockToServiceLocator('Organizations\ImageFileCache\Manager',$manager);
51
+        $this->setMockToServiceLocator('Organizations\ImageFileCache\Manager', $manager);
52 52
         $this->setMockToServiceLocator('HybridAuth', $hybridAuth);
53 53
     }
54 54
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	public function assertResponseStatusCode($code)
102 102
 	{
103 103
 		if ($this->useConsoleRequest) {
104
-			if (! in_array($code, [0, 1])) {
104
+			if (!in_array($code, [0, 1])) {
105 105
 				throw new \PHPUnit_Framework_ExpectationFailedException($this->createFailureMessage(
106 106
 					'Console status code assert value must be O (valid) or 1 (error)'
107 107
 				));
Please login to merge, or discard this patch.
module/Auth/test/AuthTest/Entity/InfoTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -242,10 +242,10 @@
 block discarded – undo
242 242
     public function provideGetDisplayNameTestData()
243 243
     {
244 244
         return array(
245
-            array(null,        null,      "[email protected]", "[email protected]"),
245
+            array(null, null, "[email protected]", "[email protected]"),
246 246
             array(" Carsten ", " Bleek ", "[email protected]", "Carsten Bleek"),
247
-            array(null,        " Bleek ", "[email protected]", "Bleek"),
248
-            array(" Carsten ", null,      "[email protected]", "[email protected]"),
247
+            array(null, " Bleek ", "[email protected]", "Bleek"),
248
+            array(" Carsten ", null, "[email protected]", "[email protected]"),
249 249
         );
250 250
     }
251 251
 
Please login to merge, or discard this patch.
module/Auth/test/AuthTest/Entity/AnonymousUserTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -83,9 +83,9 @@
 block discarded – undo
83 83
      */
84 84
     public function testGetId()
85 85
     {
86
-        $this->assertEquals('token:' . $this->target->getToken(), $this->target->getId());
86
+        $this->assertEquals('token:'.$this->target->getToken(), $this->target->getId());
87 87
 
88
-        $id=uniqid();
88
+        $id = uniqid();
89 89
         $this->target->setId($id);
90 90
         $this->assertEquals($id, $this->target->getId());
91 91
     }
Please login to merge, or discard this patch.
module/Auth/test/AuthTest/Entity/UserTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
     public function provideRoleTestData()
64 64
     {
65 65
         return array(
66
-            array(null,                 User::ROLE_USER),
67
-            array(User::ROLE_ADMIN,     User::ROLE_ADMIN),
66
+            array(null, User::ROLE_USER),
67
+            array(User::ROLE_ADMIN, User::ROLE_ADMIN),
68 68
             array(User::ROLE_RECRUITER, User::ROLE_RECRUITER),
69
-            array(User::ROLE_USER,      User::ROLE_USER),
69
+            array(User::ROLE_USER, User::ROLE_USER),
70 70
         );
71 71
     }
72 72
     /**
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     public function provideInfoTestData()
85 85
     {
86 86
         return array(
87
-            array(new Info(),     new Info()),
87
+            array(new Info(), new Info()),
88 88
         );
89 89
     }
90 90
     /**
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
     public function provideTokenTestData()
177 177
     {
178 178
         return array(
179
-            array(new Token(),     new Token()),
179
+            array(new Token(), new Token()),
180 180
         );
181 181
     }
182 182
 }
Please login to merge, or discard this patch.
module/Auth/test/AuthTest/Entity/AuthSessionTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 
61 61
     public function provideSessionTestData()
62 62
     {
63
-        $data = ["a"=>"b","c"=>[1,2,3,4]];
64
-        $serialized=serialize($data);
63
+        $data = ["a"=>"b", "c"=>[1, 2, 3, 4]];
64
+        $serialized = serialize($data);
65 65
 
66 66
         return [
67 67
             [$data, $data],
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
         $timezone = new \DateTimeZone(getenv('TIMEZONE'));
92 92
         $date = "2015-01-12 12:11:06";
93 93
         return [
94
-            [null,                 new \DateTime('now', $timezone)],
94
+            [null, new \DateTime('now', $timezone)],
95 95
             [new \DateTime($date), new \DateTime($date, $timezone)],
96
-            [$date,                new \DateTime($date, $timezone)],
96
+            [$date, new \DateTime($date, $timezone)],
97 97
         ];
98 98
     }
99 99
     /**
Please login to merge, or discard this patch.
module/Auth/test/AuthTest/Options/CaptchaOptionsTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             'imgDir' => 'public/captcha',
93 93
             'imgUrl' => '/captcha'
94 94
             ];
95
-        $target=$this->options;
95
+        $target = $this->options;
96 96
         $target->setImage($params);
97 97
 
98 98
         $this->assertSame($target->getImage(), $params);
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     public function testSetGetReCaptcha()
106 106
     {
107 107
         $params = new ReCaptcha();
108
-        $target=$this->options;
108
+        $target = $this->options;
109 109
         $target->setReCaptcha($params);
110 110
         $this->assertSame($target->getReCaptcha(), $params);
111 111
     }
Please login to merge, or discard this patch.
module/Auth/test/AuthTest/Form/RegisterTest.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -88,9 +88,9 @@
 block discarded – undo
88 88
     
89 89
     public function testWithImageField()
90 90
     {
91
-	    if (! function_exists("imageftbbox")) {
92
-		    return $this->markTestSkipped('This test requires GD FT fonts support');
93
-	    }
91
+        if (! function_exists("imageftbbox")) {
92
+            return $this->markTestSkipped('This test requires GD FT fonts support');
93
+        }
94 94
         $options = new CaptchaOptions();
95 95
         $options->setMode("image");
96 96
         $testedObject = new Register(null, $options);
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -81,20 +81,20 @@  discard block
 block discarded – undo
81 81
         $options = new CaptchaOptions();
82 82
         $options->setMode("reCaptcha");
83 83
         $testedObject = new Register(null, $options);
84
-        $captchaInput= $testedObject->get('captcha');
84
+        $captchaInput = $testedObject->get('captcha');
85 85
         $this->assertInstanceOf('Zend\Form\Element\Captcha', $captchaInput);
86 86
         $this->assertInstanceOf('Zend\Captcha\ReCaptcha', $captchaInput->getOption('captcha'));
87 87
     }
88 88
     
89 89
     public function testWithImageField()
90 90
     {
91
-	    if (! function_exists("imageftbbox")) {
91
+	    if (!function_exists("imageftbbox")) {
92 92
 		    return $this->markTestSkipped('This test requires GD FT fonts support');
93 93
 	    }
94 94
         $options = new CaptchaOptions();
95 95
         $options->setMode("image");
96 96
         $testedObject = new Register(null, $options);
97
-        $captchaInput= $testedObject->get('captcha');
97
+        $captchaInput = $testedObject->get('captcha');
98 98
         $this->assertInstanceOf('Zend\Captcha\Image', $captchaInput->getOption('captcha'));
99 99
     }
100 100
     
@@ -103,6 +103,6 @@  discard block
 block discarded – undo
103 103
         $options = new CaptchaOptions();
104 104
         $testedObject = new Register(null, $options, 'user');
105 105
         $roleField = $testedObject->get('register')->get('role');
106
-        $this->assertTrue($roleField->getValue() =='user');
106
+        $this->assertTrue($roleField->getValue() == 'user');
107 107
     }
108 108
 }
Please login to merge, or discard this patch.
Auth/test/AuthTest/Listener/SocialProfilesUnconfiguredErrorListenerTest.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 
41 41
         $events = $this->getMockBuilder('\Zend\EventManager\EventManager')->disableOriginalConstructor()->getMock();
42 42
         $events->expects($this->once())
43
-               ->method('attach')->with(MvcEvent::EVENT_DISPATCH_ERROR, [ $target, 'onDispatchError' ])
44
-               ->willReturn('worked');
43
+                ->method('attach')->with(MvcEvent::EVENT_DISPATCH_ERROR, [ $target, 'onDispatchError' ])
44
+                ->willReturn('worked');
45 45
 
46 46
         $this->assertSame($target, $target->attach($events), 'Fluent interface broken');
47 47
         $this->assertAttributeEquals(['worked'], 'listeners', $target);
@@ -50,15 +50,15 @@  discard block
 block discarded – undo
50 50
     public function provideTestData()
51 51
     {
52 52
         return [
53
-           [ true, true, true, true ],
54
-           [ false, true, true, false ],
55
-           [ true, false, true, false ],
56
-           [ true, true, false, false ],
57
-           [ false, false, true, false ],
58
-           [ false, true, false, false ],
59
-           [ true, false, false, false ],
60
-           [ false, false, false, false ],
61
-       ];
53
+            [ true, true, true, true ],
54
+            [ false, true, true, false ],
55
+            [ true, false, true, false ],
56
+            [ true, true, false, false ],
57
+            [ false, false, true, false ],
58
+            [ false, true, false, false ],
59
+            [ true, false, false, false ],
60
+            [ false, false, false, false ],
61
+        ];
62 62
     }
63 63
 
64 64
     /**
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
         $event = $this->getMockBuilder('\Zend\Mvc\MvcEvent')->disableOriginalConstructor()->getMock();
79 79
 
80 80
         $event->expects($this->once())
81
-              ->method('getParam')->with('exception')
82
-              ->willReturn($exception);
81
+                ->method('getParam')->with('exception')
82
+                ->willReturn($exception);
83 83
 
84 84
         if ($useValidModel) {
85 85
             $model = $this->getMockBuilder('\Zend\View\Model\ViewModel')->disableOriginalConstructor()->getMock();
@@ -89,16 +89,16 @@  discard block
 block discarded – undo
89 89
                 $model->expects($this->never())->method('setTemplate');
90 90
             }
91 91
             $event->expects($this->once())
92
-                  ->method('getError')
93
-                  ->willReturn($useValidError ? Application::ERROR_EXCEPTION : 'NotMatchError');
92
+                    ->method('getError')
93
+                    ->willReturn($useValidError ? Application::ERROR_EXCEPTION : 'NotMatchError');
94 94
         } else {
95 95
             $model = 'not a view model instance';
96 96
             $event->expects($this->never())->method('getError');
97 97
         }
98 98
 
99 99
         $event->expects($this->once())
100
-              ->method('getResult')
101
-              ->willReturn($model);
100
+                ->method('getResult')
101
+                ->willReturn($model);
102 102
 
103 103
         $target->onDispatchError($event);
104 104
     }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
         $events = $this->getMockBuilder('\Zend\EventManager\EventManager')->disableOriginalConstructor()->getMock();
42 42
         $events->expects($this->once())
43
-               ->method('attach')->with(MvcEvent::EVENT_DISPATCH_ERROR, [ $target, 'onDispatchError' ])
43
+               ->method('attach')->with(MvcEvent::EVENT_DISPATCH_ERROR, [$target, 'onDispatchError'])
44 44
                ->willReturn('worked');
45 45
 
46 46
         $this->assertSame($target, $target->attach($events), 'Fluent interface broken');
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
     public function provideTestData()
51 51
     {
52 52
         return [
53
-           [ true, true, true, true ],
54
-           [ false, true, true, false ],
55
-           [ true, false, true, false ],
56
-           [ true, true, false, false ],
57
-           [ false, false, true, false ],
58
-           [ false, true, false, false ],
59
-           [ true, false, false, false ],
60
-           [ false, false, false, false ],
53
+           [true, true, true, true],
54
+           [false, true, true, false],
55
+           [true, false, true, false],
56
+           [true, true, false, false],
57
+           [false, false, true, false],
58
+           [false, true, false, false],
59
+           [true, false, false, false],
60
+           [false, false, false, false],
61 61
        ];
62 62
     }
63 63
 
Please login to merge, or discard this patch.