diff --git a/lib/Core/Adapter/EmptyAdapter.php b/lib/Core/Adapter/EmptyAdapter.php new file mode 100644 index 00000000..730fca7d --- /dev/null +++ b/lib/Core/Adapter/EmptyAdapter.php @@ -0,0 +1,21 @@ + + */ +class EmptyAdapter implements AdapterInterface +{ + public function getNbResults(): int + { + return 0; + } + + public function getSlice(int $offset, int $length): iterable + { + return []; + } +} diff --git a/lib/Core/Tests/Adapter/EmptyAdapterTest.php b/lib/Core/Tests/Adapter/EmptyAdapterTest.php new file mode 100644 index 00000000..0de32633 --- /dev/null +++ b/lib/Core/Tests/Adapter/EmptyAdapterTest.php @@ -0,0 +1,23 @@ +getNbResults()); + } + + public function testGetSliceShouldReturnAnEmptyArray(): void + { + $adapter = new EmptyAdapter(); + + self::assertSame([], $adapter->getSlice(10, 5)); + } +}