Skip to content
This repository was archived by the owner on May 24, 2018. It is now read-only.

added information about methods #1532

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/src/modules/zend.test.phpunit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,16 @@ You can use directly yours query args in the url :
$this->dispatch('/tests?foo=bar&baz=foo');
}

If you would like to make more than one dispatch in your test, you must call the ``reset`` method in order for the state
the ZF2 application to be reset. ``reset`` takes one boolean parameter ``$keepPersistence`` which defaults to false.
Setting this to true will allow you to carry over the ``$_SESSION`` and ``$_COOKIE`` variables to the next dispatch.
Testing anything to do with a session may require ``reset`` to be called before the next dispatch in the test.
``reset`` is called from the ``setUp`` method, which is called before every test is begun, which is why it is good to call
``parent::setUp()`` in your own ``setUp`` method.

You may need to test if your application behaves correctly when triggering a certain event.
``triggerApplicationEvent($eventName)`` can help you do this.

Now that the request is made, it's time to start making assertions against it.

.. _zend.test.phpunit.testing-controllers.assertions:
Expand Down Expand Up @@ -163,6 +173,10 @@ to assert against the route that was matched. The following assertions can help

* ``assertMatchedRouteName($route)``: Assert that the given named route was matched by the router.

* ``assertTemplateName($name)`` : Assert that a template was used somewhere in the view model tree.

* ``assertApplicationException($type, $message = null)`` : Assert an application exception was thrown with an optional message.

Each also has a 'Not' variant for negative assertions.

.. _zend.test.phpunit.testing-controllers.assertions.css-selector:
Expand Down