Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0de9289

Browse filesBrowse files
[VarDumper] Add doc for assertDump* assertions
1 parent d6a838a commit 0de9289
Copy full SHA for 0de9289

File tree

Expand file treeCollapse file tree

1 file changed

+28
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+28
-0
lines changed

‎components/var_dumper/introduction.rst

Copy file name to clipboardExpand all lines: components/var_dumper/introduction.rst
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The VarDumper Component
1010
function that you can use instead of :phpfunction:`var_dump`.
1111

1212
.. versionadded:: 2.6
13+
1314
The VarDumper component was introduced in Symfony 2.6.
1415

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

77+
78+
79+
Using the VarDumper Component in Your PHPUnit Test Suite
80+
--------------------------------------------------------
81+
82+
The VarDumper component provides
83+
:class:`a trait <Symfony\\Component\\VarDumper\\Test\\VarDumperTestTrait>`
84+
that can help writting some of your tests for PHPUnit.
85+
By adding::
86+
87+
use \Symfony\Component\VarDumper\Test\VarDumperTestTrait;
88+
89+
at the beginning of your test class declaration, you'll gain two new assertions:
90+
91+
:method:`Symfony\\Component\\VarDumper\\Test\\VarDumperTestTrait::assertDumpEquals`
92+
verifies that the dump of the variable given as the second argument matches
93+
the expected dump provided as a string in the first argument.
94+
95+
:method:`Symfony\\Component\\VarDumper\\Test\\VarDumperTestTrait::assertDumpMatchesFormat`
96+
is like the previous method but accepts placeholders in the expected dump,
97+
based on the ``assertStringMatchesFormat`` method provided by PHPUnit.
98+
99+
.. versionadded:: 2.7
100+
101+
The :class:`Symfony\\Component\\VarDumper\\Test\\VarDumperTestTrait` was
102+
introduced in Symfony 2.7.
103+
76104
DebugBundle and Twig Integration
77105
--------------------------------
78106

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.