@@ -50,6 +50,42 @@ public static function notSame(mixed $expected, mixed $actual, string $message =
5050 ));
5151 }
5252
53+ /**
54+ * Asserts that two values are equal (not strict).
55+ *
56+ * @param mixed $expected The expected value.
57+ * @param mixed $actual The actual value to compare against the expected value.
58+ * @param string $message Short description about what exactly is being asserted.
59+ * @throws AssertException when the assertion fails.
60+ */
61+ public static function equal (mixed $ expected , mixed $ actual , string $ message = '' ): void
62+ {
63+ $ actual == $ expected
64+ ? StaticState::log ('Assert equal: ` ' . Support::stringify ($ expected ) . '` ' , $ message )
65+ : StaticState::fail (AssertException::compare ($ expected , $ actual , $ message ));
66+ }
67+
68+ /**
69+ * Asserts that two values are not equal (not strict).
70+ *
71+ * @param mixed $expected The expected value.
72+ * @param mixed $actual The actual value to compare against the expected value.
73+ * @param string $message Short description about what exactly is being asserted.
74+ * @throws AssertException when the assertion fails.
75+ */
76+ public static function notEqual (mixed $ expected , mixed $ actual , string $ message = '' ): void
77+ {
78+ $ actual != $ expected
79+ ? StaticState::log ('Assert not equal: ` ' . Support::stringify ($ expected ) . '` ' , $ message )
80+ : StaticState::fail (AssertException::compare (
81+ $ expected ,
82+ $ actual ,
83+ $ message ,
84+ pattern: 'Failed asserting that `%1s` is not equal to `%2s` ' ,
85+ showDiff: false ,
86+ ));
87+ }
88+
5389 /**
5490 * Asserts that the condition is true.
5591 *
@@ -104,7 +140,7 @@ public static function instanceOf(string $expected, mixed $actual, string $messa
104140 $ expected ,
105141 $ actual ,
106142 $ message ,
107- 'Expected instance of `%2 $s`, got `%1 $s` ' ,
143+ 'Expected instance of `%1 $s`, got `%2 $s` ' ,
108144 ));
109145 }
110146
@@ -128,7 +164,7 @@ public static function contains(mixed $needle, iterable $haystack, string $messa
128164 $ needle ,
129165 $ haystack ,
130166 $ message ,
131- 'Failed asserting that `%1 $s` contains `%2 $s` ' ,
167+ 'Failed asserting that `%2 $s` contains `%1 $s` ' ,
132168 ));
133169 }
134170
0 commit comments