@@ -73,6 +73,40 @@ current PHP SAPI:
73
73
#. From time to time, run ``composer global update `` to have the latest
74
74
bug fixes.
75
75
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
+
105
+ .. tip ::
106
+
107
+ If you still use PHP 5.3, you can extend the
108
+ :class: `Symfony\\ Component\\ VarDumper\\ Test\\ VarDumperTestClass ` instead.
109
+
76
110
DebugBundle and Twig Integration
77
111
--------------------------------
78
112
0 commit comments