Phpunit on ZendF2 Documentation

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Phpunit on ZendF2 Documentation

Nuzhser
This post has NOT been accepted by the mailing list yet.
In Zend manual is explained how to test Album model. Its says:
Testing the editAction and deleteAction methods can be easily done in a manner similar as shown for the addAction.

When testing the editAction you will also need to mock out the getAlbum method:

$albumTableMock->expects($this->once())
    ->method('getAlbum')
    ->will($this->returnValue(new \Album\Model\Album()));

Can anybody help me to do that I got an error constantly
There was 1 failure:

1) AlbumTest\Controller\AlbumControllerTest::testEditActionRedirectsAfterValidPost
Failed asserting response redirects to "/album", actual redirection is "/album/add"

/var/www/sernuzh_zb/vendor/zendframework/zendframework/library/Zend/Test/PHPUnit/Controller/AbstractHttpControllerTestCase.php:282
/var/www/sernuzh_zb/module/Album/test/AlbumTest/Controller/AlbumControllerTest.php:93

FAILURES!
Tests: 3, Assertions: 10, Failures: 1.
Reply | Threaded
Open this post in threaded view
|

Re: Phpunit on ZendF2 Documentation

Marco Pivetta
This post has NOT been accepted by the mailing list yet.
Could you please provide a gist with the controller and the test?


On 14 April 2016 at 18:02, Nuzhser [via Zend Framework Community] <[hidden email]> wrote:
In Zend manual is explained how to test Album model. Its says:
Testing the editAction and deleteAction methods can be easily done in a manner similar as shown for the addAction.

When testing the editAction you will also need to mock out the getAlbum method:

$albumTableMock->expects($this->once())
    ->method('getAlbum')
    ->will($this->returnValue(new \Album\Model\Album()));

Can anybody help me to do that I got an error constantly
There was 1 failure:

1) AlbumTest\Controller\AlbumControllerTest::testEditActionRedirectsAfterValidPost
Failed asserting response redirects to "/album", actual redirection is "/album/add"

/var/www/sernuzh_zb/vendor/zendframework/zendframework/library/Zend/Test/PHPUnit/Controller/AbstractHttpControllerTestCase.php:282
/var/www/sernuzh_zb/module/Album/test/AlbumTest/Controller/AlbumControllerTest.php:93

FAILURES!
Tests: 3, Assertions: 10, Failures: 1.



If you reply to this email, your message will be added to the discussion below:
http://zend-framework-community.634137.n4.nabble.com/Phpunit-on-ZendF2-Documentation-tp4662867.html
To start a new topic under Zend Framework, email [hidden email]
To unsubscribe from Zend Framework Community, click here.
NAML