connection = self::getContainer()->get(Connection::class); } /** * @return iterable */ public static function provideSearches(): iterable { yield ['']; yield [' ']; yield ['hugo']; yield [' hugo']; yield ['hugo ']; yield ['rue victor hugo']; yield ['rue victor hugo']; } #[DataProvider('provideSearches')] public function testFindPostalCodeDoesNotErrorAndIsIterable(string $search): void { $repository = new PostalCodeForAddressReferenceRepository($this->connection); $result = $repository->findPostalCode($search); self::assertIsIterable($result); // Ensure it can be converted to an array (and iterate without error) $rows = \is_array($result) ? $result : iterator_to_array($result, false); self::assertIsArray($rows); } }