diff --git a/src/Traits/TestTraits/PhpUnit/TestDatabaseProfilerTrait.php b/src/Traits/TestTraits/PhpUnit/TestDatabaseProfilerTrait.php index eadf3f04..2b3377ea 100644 --- a/src/Traits/TestTraits/PhpUnit/TestDatabaseProfilerTrait.php +++ b/src/Traits/TestTraits/PhpUnit/TestDatabaseProfilerTrait.php @@ -55,6 +55,24 @@ protected function assertDatabaseQueryCount(int $expectedCount): void $this->assertEquals($expectedCount, $actualCount, "Expected $expectedCount database queries, but got $actualCount."); } + /** + * Assert that the database queries contain the expected query. + */ + protected function assertDatabaseQueriesContains(string $expectedQuery): void + { + $queries = $this->getDatabaseQueries(); + + $found = false; + foreach ($queries as $query) { + if (str_contains($query['query'], $expectedQuery)) { + $found = true; + break; + } + } + + $this->assertTrue($found, "Expected query '$expectedQuery' not found in database queries."); + } + /** * Wrapper to profile database queries. */