From 336993c4cfdc51ee58344df462bcb0a33be12309 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 31 Jan 2018 17:10:35 +0100 Subject: [PATCH] Documented the new behavior of VarDumperTestTrait::assertDumpEquals --- components/var_dumper.rst | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/components/var_dumper.rst b/components/var_dumper.rst index 8ab6f71ffef..89c7a00381a 100644 --- a/components/var_dumper.rst +++ b/components/var_dumper.rst @@ -127,7 +127,7 @@ This will provide you with 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. + the expected dump provided as the first argument. :method:`Symfony\\Component\\VarDumper\\Test\\VarDumperTestTrait::assertDumpMatchesFormat` is like the previous method but accepts placeholders in the expected dump, @@ -152,10 +152,19 @@ Example:: ] EOTXT; + // if the first argument is a string, it must be the whole expected dump $this->assertDumpEquals($expectedDump, $testedVar); + + // if the first argument is not a string, assertDumpEquals() dumps it + // and compares it with the dump of the second argument + $this->assertDumpEquals($testedVar, $testedVar); } } +.. versionadded:: 4.1 + The possibility of passing non-string variables as the first argument of + ``assertDumpEquals()`` was introduced in Symfony 4.1. + Dump Examples and Output ------------------------