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 1936f22

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

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+29
-0
lines changed

‎components/var_dumper/introduction.rst

Copy file name to clipboardExpand all lines: components/var_dumper/introduction.rst
+29Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,35 @@ current PHP SAPI:
7373
#. From time to time, run ``composer global update`` to have the latest
7474
bug fixes.
7575

76+
Using the VarDumper Component in Your PHPUnit Test Suite
77+
--------------------------------------------------------
78+
79+
.. versionadded:: 2.7
80+
The :class:`Symfony\\Component\\VarDumper\\Test\\VarDumperTestTrait` was
81+
introduced in Symfony 2.7.
82+
83+
The VarDumper component provides
84+
:class:`a trait <Symfony\\Component\\VarDumper\\Test\\VarDumperTestTrait>`
85+
that can help writting some of your tests for PHPUnit.
86+
You can use it by importing it into your test classes::
87+
88+
class YourTest extends \PHPUnit_Framework_TestCase
89+
{
90+
use \Symfony\Component\VarDumper\Test\VarDumperTestTrait;
91+
92+
// ...
93+
}
94+
95+
This will provide you with two new assertions:
96+
97+
:method:`Symfony\\Component\\VarDumper\\Test\\VarDumperTestTrait::assertDumpEquals`
98+
verifies that the dump of the variable given as the second argument matches
99+
the expected dump provided as a string in the first argument.
100+
101+
:method:`Symfony\\Component\\VarDumper\\Test\\VarDumperTestTrait::assertDumpMatchesFormat`
102+
is like the previous method but accepts placeholders in the expected dump,
103+
based on the ``assertStringMatchesFormat`` method provided by PHPUnit.
104+
76105
DebugBundle and Twig Integration
77106
--------------------------------
78107

0 commit comments

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