[TYPO3-mvc] RFC: Using PHPUnit for testing controller - a tutorial

Martin Kutschker masi-no at spam-typo3.org
Tue Jan 12 12:01:28 CET 2010


Michael Knoll schrieb:
> Hi Masi,
> 
> I think that's one of the "important" questions. Perhaps I did not
> express myself in a good way. What the controller should be doing in the
> tested action is retrieving a result from a repository and put it into
> the view.
> 
> We do not want to test the repository (that must be another test) and we
> do not want to test the content of the repositories response. The only
> thing we want to make sure is that the controller puts the result into
> the view using the correct key. And that's what I'm doing here.

My question was how you're doing it. I thought that this mus happen after the call to indexAction().
But it seems that this is done via the expects() method *prior* to the actual execution of the code
to be tested.

> If you think that this is not a good example of how to test a
> controller, please let me know, then we can perhaps try somethin else...

I think it is fine. As long as you understand how PHPunit works. Which I don't ;)

Masi


More information about the TYPO3-project-typo3v4mvc mailing list