Hi,
I'm having problems with integration tests in my json API in moment of
catch an exception thrown by the application.
In my *UsersController*:
<?php
namespace App\Controller;
class UsersController extends AppController {
public function index() {
$this->request->allowMethod('get');
// ...
throw new \Cake\Core\Exception\Exception('catch me');
// ...
}
}
In my *UsersIntegrationTest*:
<?php
namespace App\Test\TestCase\Controller;
use Cake\TestSuite\IntegrationTestCase;
class UserAutenticationIntegrationTest extends IntegrationTestCase {
public $fixtures = ['app.roles', 'app.users'];
public function testCatchException() {
$this->get('/users');
$this->assertResponseError();
}
}
The *$this->assertResponseError();* throws an Exception during the test run,
failing all other tests.
I've trying using:
$this->setExpectedException('\Cake\Core\Exception\Exception');
but I can't catch anything.
*How can I solve this?*
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.