rspec/rules/S3415/php/rule.adoc
Fred Tingaud d3cfe19d7e
Fix broken or dangerous backquotes
Co-authored-by: Marco Borgeaud <89914223+marco-antognini-sonarsource@users.noreply.github.com>
2023-10-30 10:33:56 +01:00

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[]