Skip to content

Commit

Permalink
[VarDumper] Add doc for assertDump* assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Mar 31, 2015
1 parent d6a838a commit 0de9289
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions components/var_dumper/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The VarDumper Component
function that you can use instead of :phpfunction:`var_dump`.

.. versionadded:: 2.6

The VarDumper component was introduced in Symfony 2.6.

Installation
Expand Down Expand Up @@ -73,6 +74,33 @@ current PHP SAPI:
#. From time to time, run ``composer global update`` to have the latest
bug fixes.



Using the VarDumper Component in Your PHPUnit Test Suite
--------------------------------------------------------

The VarDumper component provides
:class:`a trait <Symfony\\Component\\VarDumper\\Test\\VarDumperTestTrait>`
that can help writting some of your tests for PHPUnit.
By adding::

use \Symfony\Component\VarDumper\Test\VarDumperTestTrait;

at the beginning of your test class declaration, you'll gain two new assertions:

:method:`Symfony\\Component\\VarDumper\\Test\\VarDumperTestTrait::assertDumpEquals`
verifies that the dump of the variable given as the second argument matches
the expected dump provided as a string in the first argument.

:method:`Symfony\\Component\\VarDumper\\Test\\VarDumperTestTrait::assertDumpMatchesFormat`
is like the previous method but accepts placeholders in the expected dump,
based on the ``assertStringMatchesFormat`` method provided by PHPUnit.

.. versionadded:: 2.7

The :class:`Symfony\\Component\\VarDumper\\Test\\VarDumperTestTrait` was
introduced in Symfony 2.7.

DebugBundle and Twig Integration
--------------------------------

Expand Down

0 comments on commit 0de9289

Please sign in to comment.