diff --git a/src/Expectation.php b/src/Expectation.php index afa9adcd..5b7f11aa 100644 --- a/src/Expectation.php +++ b/src/Expectation.php @@ -156,6 +156,26 @@ public function toContain($needle): Expectation return $this; } + /** + * Asserts that all of the provided $needles are elements of the value. + * + * @param array $needles + */ + public function toContainAll(array $needles): Expectation + { + if (is_string($this->value)) { + foreach ($needles as $needle) { + Assert::assertStringContainsString($needle, $this->value); + } + } else { + foreach ($needles as $needle) { + Assert::assertContains($needle, $this->value); + } + } + + return $this; + } + /** * Asserts that $count matches the number of elements of the value. */