From 79f5973e5aa42fc5151f0084ff08f79d5f2beb14 Mon Sep 17 00:00:00 2001 From: Erik Gaal Date: Tue, 3 Oct 2023 11:09:26 +0200 Subject: [PATCH] Add tests --- tests/Features/Expect/toContainEquals.php | 36 +++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tests/Features/Expect/toContainEquals.php diff --git a/tests/Features/Expect/toContainEquals.php b/tests/Features/Expect/toContainEquals.php new file mode 100644 index 00000000..a789b41d --- /dev/null +++ b/tests/Features/Expect/toContainEquals.php @@ -0,0 +1,36 @@ +toContain('42'); +}); + +test('passes arrays with multiple needles', function () { + expect([1, 2, 42])->toContain('42', '2'); +}); + +test('failures', function () { + expect([1, 2, 42])->toContain('3'); +})->throws(ExpectationFailedException::class); + +test('failures with multiple needles (all failing)', function () { + expect([1, 2, 42])->toContainEquals('3', '4'); +})->throws(ExpectationFailedException::class); + +test('failures with multiple needles (some failing)', function () { + expect([1, 2, 42])->toContainEquals('1', '3', '4'); +})->throws(ExpectationFailedException::class); + +test('not failures', function () { + expect([1, 2, 42])->not->toContainEquals('42'); +})->throws(ExpectationFailedException::class); + +test('not failures with multiple needles (all failing)', function () { + expect([1, 2, 42])->not->toContainEquals('42', '2'); +})->throws(ExpectationFailedException::class); + +test('not failures with multiple needles (some failing)', function () { + expect([1, 2, 42])->not->toContainEquals('42', '1'); +})->throws(ExpectationFailedException::class);