@@ -50,6 +50,47 @@ 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 equals (mixed $ expected , mixed $ actual , string $ message = '' ): void
62+ {
63+ $ actual == $ expected
64+ ? StaticState::log ('Assert equals: ` ' . Support::stringify ($ expected ) . '` ' , $ message )
65+ : StaticState::fail (AssertException::compare (
66+ $ expected ,
67+ $ actual ,
68+ $ message ,
69+ pattern: 'Failed asserting that `%1s` is equals to `%2s` ' ,
70+ ));
71+ }
72+
73+ /**
74+ * Asserts that two values are not equal (not strict).
75+ *
76+ * @param mixed $expected The expected value.
77+ * @param mixed $actual The actual value to compare against the expected value.
78+ * @param string $message Short description about what exactly is being asserted.
79+ * @throws AssertException when the assertion fails.
80+ */
81+ public static function notEquals (mixed $ expected , mixed $ actual , string $ message = '' ): void
82+ {
83+ $ actual != $ expected
84+ ? StaticState::log ('Assert not equals: ` ' . Support::stringify ($ expected ) . '` ' , $ message )
85+ : StaticState::fail (AssertException::compare (
86+ $ expected ,
87+ $ actual ,
88+ $ message ,
89+ pattern: 'Failed asserting that `%1s` is not equals to `%2s` ' ,
90+ showDiff: false ,
91+ ));
92+ }
93+
5394 /**
5495 * Asserts that the condition is true.
5596 *
@@ -104,7 +145,7 @@ public static function instanceOf(string $expected, mixed $actual, string $messa
104145 $ expected ,
105146 $ actual ,
106147 $ message ,
107- 'Expected instance of `%2 $s`, got `%1 $s` ' ,
148+ 'Expected instance of `%1 $s`, got `%2 $s` ' ,
108149 ));
109150 }
110151
@@ -128,7 +169,7 @@ public static function contains(mixed $needle, iterable $haystack, string $messa
128169 $ needle ,
129170 $ haystack ,
130171 $ message ,
131- 'Failed asserting that `%1 $s` contains `%2 $s` ' ,
172+ 'Failed asserting that `%2 $s` contains `%1 $s` ' ,
132173 ));
133174 }
134175
0 commit comments