Skip to content

Commit

Permalink
Fixing some failing unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Aug 30, 2014
1 parent 18ed6de commit 512d385
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 19 deletions.
6 changes: 3 additions & 3 deletions tests/TestCase/Auth/BasicAuthenticateTest.php
Expand Up @@ -15,7 +15,7 @@
namespace Cake\Test\TestCase\Auth;

use Cake\Auth\BasicAuthenticate;
use Cake\Error;
use Cake\Network\Exception\UnauthorizedException;
use Cake\Network\Request;
use Cake\ORM\Entity;
use Cake\ORM\TableRegistry;
Expand Down Expand Up @@ -168,7 +168,7 @@ public function testAuthenticateChallenge() {

try {
$this->auth->unauthenticated($request, $this->response);
} catch (Error\UnauthorizedException $e) {
} catch (UnauthorizedException $e) {
}

$this->assertNotEmpty($e);
Expand Down Expand Up @@ -205,7 +205,7 @@ public function testAuthenticateSuccess() {
/**
* test scope failure.
*
* @expectedException \Cake\Error\UnauthorizedException
* @expectedException \Cake\Network\Exception\UnauthorizedException
* @expectedExceptionCode 401
* @return void
*/
Expand Down
8 changes: 4 additions & 4 deletions tests/TestCase/Auth/DigestAuthenticateTest.php
Expand Up @@ -17,7 +17,7 @@
namespace Cake\Test\TestCase\Auth;

use Cake\Auth\DigestAuthenticate;
use Cake\Error;
use Cake\Network\Exception\UnauthorizedException;
use Cake\Network\Request;
use Cake\ORM\Entity;
use Cake\ORM\TableRegistry;
Expand Down Expand Up @@ -93,7 +93,7 @@ public function testAuthenticateNoData() {
/**
* test the authenticate method
*
* @expectedException \Cake\Error\UnauthorizedException
* @expectedException \Cake\Network\Exception\UnauthorizedException
* @expectedExceptionCode 401
* @return void
*/
Expand Down Expand Up @@ -131,7 +131,7 @@ public function testAuthenticateChallenge() {

try {
$this->auth->unauthenticated($request, $this->response);
} catch (Error\UnauthorizedException $e) {
} catch (UnauthorizedException $e) {
}

$this->assertNotEmpty($e);
Expand Down Expand Up @@ -178,7 +178,7 @@ public function testAuthenticateSuccess() {
/**
* test scope failure.
*
* @expectedException \Cake\Error\UnauthorizedException
* @expectedException \Cake\Network\Exception\UnauthorizedException
* @expectedExceptionCode 401
* @return void
*/
Expand Down
1 change: 1 addition & 0 deletions tests/TestCase/Cache/Engine/RedisEngineTest.php
Expand Up @@ -87,6 +87,7 @@ public function testConfig() {
'persistent' => true,
'password' => false,
'database' => 0,
'unix_socket' => false
);
$this->assertEquals($expecting, $config);
}
Expand Down
7 changes: 4 additions & 3 deletions tests/TestCase/Controller/Component/AuthComponentTest.php
Expand Up @@ -19,8 +19,9 @@
use Cake\Controller\Controller;
use Cake\Core\App;
use Cake\Core\Configure;
use Cake\Error;
use Cake\Event\Event;
use Cake\Network\Exception\ForbiddenException;
use Cake\Network\Exception\UnauthorizedException;
use Cake\Network\Request;
use Cake\Network\Response;
use Cake\Network\Session;
Expand Down Expand Up @@ -789,7 +790,7 @@ public function testRedirectToUnauthorizedRedirectSuppressedAuthError() {
/**
* Throw ForbiddenException if config `unauthorizedRedirect` is set to false
*
* @expectedException \Cake\Error\ForbiddenException
* @expectedException \Cake\Network\Exception\ForbiddenException
* @return void
*/
public function testForbiddenException() {
Expand Down Expand Up @@ -1261,7 +1262,7 @@ public function testUser() {
/**
* testStatelessAuthNoRedirect method
*
* @expectedException \Cake\Error\UnauthorizedException
* @expectedException \Cake\Network\Exception\UnauthorizedException
* @expectedExceptionCode 401
* @return void
*/
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/Controller/Component/CsrfComponentTest.php
Expand Up @@ -107,7 +107,7 @@ public function testValidTokenInHeader($method) {
* Test that the X-CSRF-Token works with the various http methods.
*
* @dataProvider httpMethodProvider
* @expectedException \Cake\Error\ForbiddenException
* @expectedException \Cake\Network\Exception\ForbiddenException
* @return void
*/
public function testInvalidTokenInHeader($method) {
Expand Down Expand Up @@ -149,7 +149,7 @@ public function testValidTokenRequestData($method) {
* Test that request data works with the various http methods.
*
* @dataProvider httpMethodProvider
* @expectedException \Cake\Error\ForbiddenException
* @expectedException \Cake\Network\Exception\ForbiddenException
* @return void
*/
public function testInvalidTokenRequestData($method) {
Expand Down
Expand Up @@ -19,7 +19,7 @@
use Cake\Controller\Controller;
use Cake\Core\Configure;
use Cake\Datasource\ConnectionManager;
use Cake\Error;
use Cake\Network\Exception\NotFoundException;
use Cake\Network\Request;
use Cake\ORM\TableRegistry;
use Cake\TestSuite\TestCase;
Expand Down Expand Up @@ -472,7 +472,7 @@ public function testOutOfRangePageNumberGetsClamped() {
try {
$this->Paginator->paginate($table);
$this->fail('No exception raised');
} catch (\Cake\Error\NotFoundException $e) {
} catch (NotFoundException $e) {
$this->assertEquals(
1,
$this->request->params['paging']['PaginatorPosts']['page'],
Expand All @@ -484,7 +484,7 @@ public function testOutOfRangePageNumberGetsClamped() {
/**
* Test that a really REALLY large page number gets clamped to the max page size.
*
* @expectedException \Cake\Error\NotFoundException
* @expectedException \Cake\Network\Exception\NotFoundException
* @return void
*/
public function testOutOfVeryBigPageNumberGetsClamped() {
Expand Down
8 changes: 4 additions & 4 deletions tests/TestCase/Network/ResponseTest.php
Expand Up @@ -113,7 +113,7 @@ public function testCharset() {
/**
* Tests the statusCode method
*
* @expectedException \Cake\Core\Exception\Exception
* @expectedException InvalidArgumentException
* @return void
*/
public function testStatusCode() {
Expand Down Expand Up @@ -398,7 +398,7 @@ public function testCompress() {
/**
* Tests the httpCodes method
*
* @expectedException \Cake\Core\Exception\Exception
* @expectedException InvalidArgumentException
* @return void
*/
public function testHttpCodes() {
Expand Down Expand Up @@ -1158,7 +1158,7 @@ public function corsData() {
/**
* testFileNotFound
*
* @expectedException \Cake\Error\NotFoundException
* @expectedException InvalidArgumentException
* @return void
*/
public function testFileNotFound() {
Expand All @@ -1169,7 +1169,7 @@ public function testFileNotFound() {
/**
* test file with ..
*
* @expectedException Cake\Error\NotFoundException
* @expectedException InvalidArgumentException
* @return void
*/
public function testFileWithPathTraversal() {
Expand Down

0 comments on commit 512d385

Please sign in to comment.