createMock(Homepage::class); $homepage->method('getId')->willReturn(1); $homepage->method('getData')->willReturnMap([ ['title', null, 'Wiki'], ['content', null, '

Wiki content

'], ['meta_title', null, 'Wiki meta'], ['meta_description', null, 'Wiki description'], ['meta_keywords', null, 'Wiki keywords'], ]); $collection = $this->createMock(Collection::class); $collection->method('addFieldToFilter')->willReturnSelf(); $collection->method('setPageSize')->willReturnSelf(); $collection->method('getFirstItem')->willReturn($homepage); $factory = $this->createMock(CollectionFactory::class); $factory->method('create')->willReturn($collection); $repository = $this->createMock(CmsTranslationRepository::class); $repository->method('getTranslations')->willReturn([]); $fields = (new WikiHomepageEntity( $factory, $repository, $this->createMock(SkippedFields::class) ))->getFields(1, 0, 16); self::assertSame(['title', 'content', 'meta_title', 'meta_description', 'meta_keywords'], array_column($fields, 'code')); self::assertTrue($fields[1]['is_html']); } }