Skip to content

Commit 512d385

Browse files
committed
Fixing some failing unit tests
1 parent 18ed6de commit 512d385

File tree

7 files changed

+21
-19
lines changed

7 files changed

+21
-19
lines changed

tests/TestCase/Auth/BasicAuthenticateTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
namespace Cake\Test\TestCase\Auth;
1616

1717
use Cake\Auth\BasicAuthenticate;
18-
use Cake\Error;
18+
use Cake\Network\Exception\UnauthorizedException;
1919
use Cake\Network\Request;
2020
use Cake\ORM\Entity;
2121
use Cake\ORM\TableRegistry;
@@ -168,7 +168,7 @@ public function testAuthenticateChallenge() {
168168

169169
try {
170170
$this->auth->unauthenticated($request, $this->response);
171-
} catch (Error\UnauthorizedException $e) {
171+
} catch (UnauthorizedException $e) {
172172
}
173173

174174
$this->assertNotEmpty($e);
@@ -205,7 +205,7 @@ public function testAuthenticateSuccess() {
205205
/**
206206
* test scope failure.
207207
*
208-
* @expectedException \Cake\Error\UnauthorizedException
208+
* @expectedException \Cake\Network\Exception\UnauthorizedException
209209
* @expectedExceptionCode 401
210210
* @return void
211211
*/

tests/TestCase/Auth/DigestAuthenticateTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
namespace Cake\Test\TestCase\Auth;
1818

1919
use Cake\Auth\DigestAuthenticate;
20-
use Cake\Error;
20+
use Cake\Network\Exception\UnauthorizedException;
2121
use Cake\Network\Request;
2222
use Cake\ORM\Entity;
2323
use Cake\ORM\TableRegistry;
@@ -93,7 +93,7 @@ public function testAuthenticateNoData() {
9393
/**
9494
* test the authenticate method
9595
*
96-
* @expectedException \Cake\Error\UnauthorizedException
96+
* @expectedException \Cake\Network\Exception\UnauthorizedException
9797
* @expectedExceptionCode 401
9898
* @return void
9999
*/
@@ -131,7 +131,7 @@ public function testAuthenticateChallenge() {
131131

132132
try {
133133
$this->auth->unauthenticated($request, $this->response);
134-
} catch (Error\UnauthorizedException $e) {
134+
} catch (UnauthorizedException $e) {
135135
}
136136

137137
$this->assertNotEmpty($e);
@@ -178,7 +178,7 @@ public function testAuthenticateSuccess() {
178178
/**
179179
* test scope failure.
180180
*
181-
* @expectedException \Cake\Error\UnauthorizedException
181+
* @expectedException \Cake\Network\Exception\UnauthorizedException
182182
* @expectedExceptionCode 401
183183
* @return void
184184
*/

tests/TestCase/Cache/Engine/RedisEngineTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public function testConfig() {
8787
'persistent' => true,
8888
'password' => false,
8989
'database' => 0,
90+
'unix_socket' => false
9091
);
9192
$this->assertEquals($expecting, $config);
9293
}

tests/TestCase/Controller/Component/AuthComponentTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
use Cake\Controller\Controller;
2020
use Cake\Core\App;
2121
use Cake\Core\Configure;
22-
use Cake\Error;
2322
use Cake\Event\Event;
23+
use Cake\Network\Exception\ForbiddenException;
24+
use Cake\Network\Exception\UnauthorizedException;
2425
use Cake\Network\Request;
2526
use Cake\Network\Response;
2627
use Cake\Network\Session;
@@ -789,7 +790,7 @@ public function testRedirectToUnauthorizedRedirectSuppressedAuthError() {
789790
/**
790791
* Throw ForbiddenException if config `unauthorizedRedirect` is set to false
791792
*
792-
* @expectedException \Cake\Error\ForbiddenException
793+
* @expectedException \Cake\Network\Exception\ForbiddenException
793794
* @return void
794795
*/
795796
public function testForbiddenException() {
@@ -1261,7 +1262,7 @@ public function testUser() {
12611262
/**
12621263
* testStatelessAuthNoRedirect method
12631264
*
1264-
* @expectedException \Cake\Error\UnauthorizedException
1265+
* @expectedException \Cake\Network\Exception\UnauthorizedException
12651266
* @expectedExceptionCode 401
12661267
* @return void
12671268
*/

tests/TestCase/Controller/Component/CsrfComponentTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function testValidTokenInHeader($method) {
107107
* Test that the X-CSRF-Token works with the various http methods.
108108
*
109109
* @dataProvider httpMethodProvider
110-
* @expectedException \Cake\Error\ForbiddenException
110+
* @expectedException \Cake\Network\Exception\ForbiddenException
111111
* @return void
112112
*/
113113
public function testInvalidTokenInHeader($method) {
@@ -149,7 +149,7 @@ public function testValidTokenRequestData($method) {
149149
* Test that request data works with the various http methods.
150150
*
151151
* @dataProvider httpMethodProvider
152-
* @expectedException \Cake\Error\ForbiddenException
152+
* @expectedException \Cake\Network\Exception\ForbiddenException
153153
* @return void
154154
*/
155155
public function testInvalidTokenRequestData($method) {

tests/TestCase/Controller/Component/PaginatorComponentTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use Cake\Controller\Controller;
2020
use Cake\Core\Configure;
2121
use Cake\Datasource\ConnectionManager;
22-
use Cake\Error;
22+
use Cake\Network\Exception\NotFoundException;
2323
use Cake\Network\Request;
2424
use Cake\ORM\TableRegistry;
2525
use Cake\TestSuite\TestCase;
@@ -472,7 +472,7 @@ public function testOutOfRangePageNumberGetsClamped() {
472472
try {
473473
$this->Paginator->paginate($table);
474474
$this->fail('No exception raised');
475-
} catch (\Cake\Error\NotFoundException $e) {
475+
} catch (NotFoundException $e) {
476476
$this->assertEquals(
477477
1,
478478
$this->request->params['paging']['PaginatorPosts']['page'],
@@ -484,7 +484,7 @@ public function testOutOfRangePageNumberGetsClamped() {
484484
/**
485485
* Test that a really REALLY large page number gets clamped to the max page size.
486486
*
487-
* @expectedException \Cake\Error\NotFoundException
487+
* @expectedException \Cake\Network\Exception\NotFoundException
488488
* @return void
489489
*/
490490
public function testOutOfVeryBigPageNumberGetsClamped() {

tests/TestCase/Network/ResponseTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function testCharset() {
113113
/**
114114
* Tests the statusCode method
115115
*
116-
* @expectedException \Cake\Core\Exception\Exception
116+
* @expectedException InvalidArgumentException
117117
* @return void
118118
*/
119119
public function testStatusCode() {
@@ -398,7 +398,7 @@ public function testCompress() {
398398
/**
399399
* Tests the httpCodes method
400400
*
401-
* @expectedException \Cake\Core\Exception\Exception
401+
* @expectedException InvalidArgumentException
402402
* @return void
403403
*/
404404
public function testHttpCodes() {
@@ -1158,7 +1158,7 @@ public function corsData() {
11581158
/**
11591159
* testFileNotFound
11601160
*
1161-
* @expectedException \Cake\Error\NotFoundException
1161+
* @expectedException InvalidArgumentException
11621162
* @return void
11631163
*/
11641164
public function testFileNotFound() {
@@ -1169,7 +1169,7 @@ public function testFileNotFound() {
11691169
/**
11701170
* test file with ..
11711171
*
1172-
* @expectedException Cake\Error\NotFoundException
1172+
* @expectedException InvalidArgumentException
11731173
* @return void
11741174
*/
11751175
public function testFileWithPathTraversal() {

0 commit comments

Comments
 (0)