-- Tuan Ngo <[EMAIL PROTECTED]> wrote
(on Monday, 07 July 2008, 06:08 PM +0700):
> Nothing but default header text of PHPUnit:
>
> [EMAIL PROTECTED]:~/ws/www/apptest$ phpunit TestSearchController.php
Okay, spotting some issues right off the bat here. First, PHPUnit
expects test case classes to end in 'Test', so that should be
SearchControllerTest.php. Second, you should be passing a class name,
not a file to PHPUnit.
> PHPUnit 3.2.19 by Sebastian Bergmann.
>
> [EMAIL PROTECTED]:~/ws/www/apptest$
Third, after making those changes, try running the following:
phpunit -d 'display_errors=1' -d 'error_reporting=8191' SearchControllerTest
and see if you get any error messages. Send the output of running that
command to the list.
Fourth, can you indicate what version of PHP you're using?
Finally, can you send your test class? I may be able to better diagnose
by looking at some representative code.
> - Tuan Ngo.
> On Mon, Jul 7, 2008 at 5:56 PM, Paul Shoemaker
> <[EMAIL PROTECTED]> wrote:
> > May I ask what output you are receiving from the cli? Error messages?
> >
> > Paul
> >
> > ----- Original Message -----
> > From: Tuan Ngo <[EMAIL PROTECTED]>
> > To: [email protected] <[email protected]>;
> > [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> > Sent: Mon Jul 07 03:34:20 2008
> > Subject: Re: [fw-mvc] MVC testing scaffold is feature complete
> >
> > Hi Matthew,
> >
> > In my project, I already used PHPUnit test for Model classes but still
> > not found a way to test Controller classes. So your introduction about
> > MVC testing class is great news for me.
> >
> > My project doesn't use normal html view but it includes a flash client
> > and a php middleware written in Zend_Framework. Flash client gets data
> > in Json format through ZendFramework. So we only implement MC part,
> > and really no view at all.
> >
> > I try to setup Unit test for Controller part. It seems that your test
> > framework doesn't like json format :) because after run test nothing
> > return. My action code look like this:
> > public function searchAction(){
> > //data validation
> > //get data from database
> > $this->_helper->json($result);
> > }
> >
> > I try to diagnose by add some sample code code in action
> > public function searchAction(){
> > $this->view->hello = "hello world"; return;
> > }
> > and Setup a view script
> >
> > and with simple testcase
> > public function testSearchAction(){
> > $this->dispatch('/search/search');
> > $a = $this->getResponse();
> > var_dump($a);
> > $this->assertResponseCode(200);
> > }
> >
> > I can see data of Zend_Controller_Response_HttpTestCase object with
> > HTML data in it and a testcase passed.
> >
> > Once more, I try with very simple code which return json data:
> > public function searchAction(){
> > $this->_helper->json("hello world"); return;
> > }
> > and with the same above testcase, nothing display after run test
> >
> > May I do something wrong?
> >
> > - Tuan Ngo.
> >
> > On Tue, Jul 1, 2008 at 1:40 AM, Matthew Weier O'Phinney
> > <[EMAIL PROTECTED]> wrote:
> >> Greetings, all.
> >>
> >> This morning, I blogged about a new feature for 1.6 that you should
> >> start looking at: a functional testing scaffold for your MVC
> >> applications. You can read more about it here:
> >>
> >>
> >> http://weierophinney.net/matthew/archives/182-Testing-Zend-Framework-MVC-Applications.html
> >>
> >> The basic idea is that you setup your bootstrapping, and start writing
> >> test methods. Your test methods would setup the request environment (if
> >> necessary), dispatch a url, and then make assertions against the final
> >> environment. No actual web server is required, as the environment is
> >> encapsulated in the request and response objects.
> >>
> >> This code is in the incubator; please pull via SVN and start testing!
> >>
> >> --
> >> Matthew Weier O'Phinney
> >> Software Architect | [EMAIL PROTECTED]
> >> Zend Framework | http://framework.zend.com/
> >>
> >>
> >
>
--
Matthew Weier O'Phinney
Software Architect | [EMAIL PROTECTED]
Zend Framework | http://framework.zend.com/