php - PHPunit test not following through after ZF form validation -


i'm brand new phpunit testing. can me on how test lines below in image.

img example

so far test is:

public function testcansendemail() {     $formdata = array(         'subject'   => 'test subject',         'email'     => 'test@mail.com',         'message'   => 'test message',         'name'      => 'test name');      $this->request         ->setmethod('post')         ->setpost($formdata);     $this->dispatch('/contact');     $this->assertaction('win'); 

i under impression if validation succeeded follow through whole action? can please explain happening here, , correct test such action.

the obvious explanation $form->isvalid returns false.

the coverage report shows if block valid form never got executed. instead, else block executed. thing need find out why , eliminate cause. use debugger , step through execution flow see happens @ runtime.

as alternative, can stub contact form return true. because form hardcoded controller action, have @ http://sebastian-bergmann.de/archives/885-stubbing-hard-coded-dependencies.html on how that.

yet alternative: make code send contact form service layer allow testing without having make actual request.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -