@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | public function tearDown() { |
| 55 | - if($this->securityWasEnabled) SecurityToken::enable(); |
|
| 55 | + if ($this->securityWasEnabled) SecurityToken::enable(); |
|
| 56 | 56 | else SecurityToken::disable(); |
| 57 | 57 | Injector::unnest(); |
| 58 | 58 | Config::unnest(); |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | ) |
| 145 | 145 | ); |
| 146 | 146 | $response = $this->post('spellcheck', array('ajax' => 1, 'json_data' => json_encode($dataCheckWords))); |
| 147 | - $this->assertEquals(200, $response->getStatusCode()); |
|
| 147 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 148 | 148 | $jsonBody = json_decode($response->getBody()); |
| 149 | 149 | $this->assertEquals('c0', $jsonBody->id); |
| 150 | 150 | $this->assertEquals(array("collor", "color", "onee"), $jsonBody->result); |
@@ -160,14 +160,14 @@ discard block |
||
| 160 | 160 | ) |
| 161 | 161 | ); |
| 162 | 162 | $response = $this->post('spellcheck', array('ajax' => 1, 'json_data' => json_encode($dataGetSuggestions))); |
| 163 | - $this->assertEquals(200, $response->getStatusCode()); |
|
| 163 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 164 | 164 | $jsonBody = json_decode($response->getBody()); |
| 165 | 165 | $this->assertEquals('c1', $jsonBody->id); |
| 166 | 166 | $this->assertEquals(array('collar', 'colour'), $jsonBody->result); |
| 167 | 167 | |
| 168 | 168 | // Test non-ajax rejection |
| 169 | 169 | $response = $this->post('spellcheck', array('json_data' => json_encode($dataCheckWords))); |
| 170 | - $this->assertEquals(400, $response->getStatusCode()); |
|
| 170 | + $this->assertEquals(400, $response->getStatusCode()); |
|
| 171 | 171 | $jsonBody = json_decode($response->getBody()); |
| 172 | 172 | $this->assertEquals($invalidRequest, $jsonBody->error->errstr); |
| 173 | 173 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $dataInvalidMethod = $dataCheckWords; |
| 176 | 176 | $dataInvalidMethod['method'] = 'validate'; |
| 177 | 177 | $response = $this->post('spellcheck', array('ajax' => 1, 'json_data' => json_encode($dataInvalidMethod))); |
| 178 | - $this->assertEquals(400, $response->getStatusCode()); |
|
| 178 | + $this->assertEquals(400, $response->getStatusCode()); |
|
| 179 | 179 | $jsonBody = json_decode($response->getBody()); |
| 180 | 180 | $this->assertEquals( |
| 181 | 181 | _t('SpellController.UnsupportedMethod', "Unsupported method '{method}'", array('method' => 'validate')), |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $dataNoMethod = $dataCheckWords; |
| 187 | 187 | unset($dataNoMethod['method']); |
| 188 | 188 | $response = $this->post('spellcheck', array('ajax' => 1, 'json_data' => json_encode($dataNoMethod))); |
| 189 | - $this->assertEquals(400, $response->getStatusCode()); |
|
| 189 | + $this->assertEquals(400, $response->getStatusCode()); |
|
| 190 | 190 | $jsonBody = json_decode($response->getBody()); |
| 191 | 191 | $this->assertEquals($invalidRequest, $jsonBody->error->errstr); |
| 192 | 192 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | array('collor', 'colour', 'color', 'onee', 'correct') |
| 198 | 198 | ); |
| 199 | 199 | $response = $this->post('spellcheck', array('ajax' => 1, 'json_data' => json_encode($dataWrongLocale))); |
| 200 | - $this->assertEquals(400, $response->getStatusCode()); |
|
| 200 | + $this->assertEquals(400, $response->getStatusCode()); |
|
| 201 | 201 | $jsonBody = json_decode($response->getBody()); |
| 202 | 202 | $this->assertEquals(_t('SpellController.InvalidLocale', 'Not supported locale'), $jsonBody->error->errstr); |
| 203 | 203 | } |
@@ -52,8 +52,11 @@ |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | public function tearDown() { |
| 55 | - if($this->securityWasEnabled) SecurityToken::enable(); |
|
| 56 | - else SecurityToken::disable(); |
|
| 55 | + if($this->securityWasEnabled) { |
|
| 56 | + SecurityToken::enable(); |
|
| 57 | + } else { |
|
| 58 | + SecurityToken::disable(); |
|
| 59 | + } |
|
| 57 | 60 | Injector::unnest(); |
| 58 | 61 | Config::unnest(); |
| 59 | 62 | parent::tearDown(); |