Skip to content

Documented the new behavior of VarDumperTestTrait::assertDumpEquals #9184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 1, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion components/var_dumper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
------------------------

Expand Down