lundi 31 mars 2014

CakePHP Unit testing controller returning undefined variable


Vote count:

0




I am new to the Unit Testing portion of CakePHP. There is no better time to learn than now.


I have ready through all of the documentation and numerous tutorials on the web. I have run up against a snag during the completion of some of my more basic unit tests.


My Controller test looks like this:



class TestsControllerTest extends ControllerTestCase {

public $fixtures = array('app.test');

public function testIndex() {

$result = $this->testAction('tests/index');
debug($result);
}
}


The output of my test is:



PHPUNIT_FRAMEWORK_ERROR_NOTICE
Undefined variable: tests
Test case: testsControllerTest(testIndex)


The only viable solution to the error I am receiving would be that maybe the test controller needs authentication before it can actually run the testAction() ?


This is a very simple sample from the CakePHP Documentation guide, yet I receive and undefined variable error. Any help is greatly appreciated.



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire