I can not call a controller in a cakephp2 test, I want to call a controller but using App::import
or App::uses
will not let me, nor will I call the $this->testAction
How could I call him?
I have used it in the following way:
App::uses('Controller', 'Api2Controller');
/**
* Api2Controller Test Case
*
*/
class Api2ControllerTest extends ControllerTestCase {
// public $fixtures = array('Api2Controller.crearDireccion');
function setUp(){
parent::setUp();
$this->Api2 = ClassRegistry::init('Api2Controller');
}
function tearDown(){
parent::tearDown();
}
public function testArraySearchRecursive() {
$this->Api2->mimetodo();
}
but it does not work, I have also called the controller from the same method for App::import('Controller', 'Api2Controller')
then I make an instance of it but I see PHP Fatal error: Class 'Api2Controller' not found