
Co-authored-by: Marco Borgeaud <89914223+marco-antognini-sonarsource@users.noreply.github.com>
38 lines
868 B
Plaintext
38 lines
868 B
Plaintext
== Why is this an issue?
|
|
|
|
The standard PHPUnit assertion methods such as ``++__assertEquals__++``, expect the first argument to be the expected value and the second argument to be the actual value.
|
|
|
|
include::../impact.adoc[]
|
|
|
|
include::../howtofix.adoc[]
|
|
|
|
=== Code examples
|
|
|
|
==== Noncompliant code example
|
|
|
|
[source,php,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
self::assertEquals($runner.getExitCode(), 0, "Unexpected exit code"); // Noncompliant; Failed asserting that 0 matches expected 3. Expected :3 Actual :0.
|
|
----
|
|
|
|
==== Compliant solution
|
|
|
|
[source,php,diff-id=1,diff-type=compliant]
|
|
----
|
|
self::assertEquals(0, $runner.getExitCode(), "Unexpected exit code");
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
include::../highlighting.adoc[]
|
|
|
|
'''
|
|
|
|
endif::env-github,rspecator-view[]
|