2015/05/04 at 4:05 pm #758
I’m completed the chapter about Unit Testing (book pg 103), but am receiving the following error when I try to run the phpunit.xml as a phpUnit test:
Fatal error: Call to undefined method UserTestControllerAccountControllerTest::dispach() in C:xampphtdocsZendProjectslearnzf2moduleUsertestsUserControllerAccountControllerTest.php on line 26
Here is the code in the AccountControllerTest.php, and I have verified that the file exists. It won’t recognize my attempt to extend the AbstractHttpControllerTestCase, even though it doesn’t complain about the definition of AbstractHttpControllerTestCase just above it.
class AccountControllerTest extends AbstractHttpControllerTestCase
protected $traceError = true;
public function setUp()
public function testMeAction()
// $application = $this->getApplication();
// $serviceManager = $this->getServiceManager();
// $eventManager = $this->getEventManager();
// This is how the request object can be accessed and modified.
// $request = $this->getRequest();
// The dispatch method returns the result
$result = $this->dispach(‘/user/account/me’);
//This is how the response object can be accessed.
// $response = $this->getResponse();
//And here we can use the response to check the status code.
// $this->assertEquals(200, $response->getStatusCode());
I have created a githup if you need it.2015/05/04 at 4:46 pm #759
Hi wattp, please, tell me the URL of the github repo and I can take a look later this week. In addition what command (the exact syntax please) are you executing on your system and what version of PHPUnit is used?2015/05/04 at 5:19 pm #760
I am running the test through Zend Studio 12.5 by right clicking on the phpunit.xml file and selecting Run As->PHPUnit Test. I have PHPUnit and PHPUnit 4 installed (I’m trying to use PHPUnit 4, but it’s not giving me an option). I am on a Windows machine.2015/05/04 at 5:53 pm #761
OK, I figured out I was excluding the Test directory from my project, so that was causing the extend error from AbstractHttpControllerTestCase. However, I am still having the same error.2015/05/04 at 9:30 pm #762
After I re-included the Test directory, I realized that I misspelled dispatch, so never mind. I’ll post again here if I run into anything I can’t figure out. Bah.2015/05/05 at 10:53 am #763
> I realized that I misspelled dispatch…
> I’ll post again here if I run into anything I can’t figure out…
Ok, no problem 🙂
You must be logged in to reply to this topic.