Mock nodeStorage

> TypeError: uasort(): Argument #1 ($array) must be of type array, null given
This commit is contained in:
Oliver Davies 2024-01-22 17:20:25 +00:00 committed by Oliver Davies
parent 0c162ed08e
commit 09f7f528b9

View file

@ -13,9 +13,12 @@ final class PostNodeRepositoryUnitTest extends UnitTestCase {
/** @test */
public function it_returns_posts(): void {
$repository = new PostNodeRepository(
$this->createMock(EntityTypeManagerInterface::class),
);
$nodeStorage = $this->createMock(EntityStorageInterface::class);
$entityTypeManager = $this->createMock(EntityTypeManagerInterface::class);
$entityTypeManager->method('getStorage')->with('node')->willReturn($nodeStorage);
$repository = new PostNodeRepository($entityTypeManager);
$repository->findAll();
}