createMock(Category::class); $first->method('getId')->willReturn(12); $first->expects(self::once())->method('setData')->with('title', 'Titel 12'); $second = $this->createMock(Category::class); $second->method('getId')->willReturn(13); $second->expects(self::once())->method('setData')->with('summary', 'Zusammenfassung 13'); $repository = $this->createMock(CmsTranslationRepository::class); $repository->expects(self::once())->method('getTranslationsForEntities')->with( [12, 13], 16, CmsTranslationRepository::ENTITY_WIKI_CATEGORY, self::isType('array') )->willReturn([ 12 => ['title' => 'Titel 12'], 13 => ['summary' => 'Zusammenfassung 13'], ]); $store = $this->createMock(StoreInterface::class); $store->method('getId')->willReturn(16); $storeManager = $this->createMock(StoreManagerInterface::class); $storeManager->method('getStore')->willReturn($store); $state = $this->createMock(State::class); $state->method('getAreaCode')->willReturn('frontend'); (new WikiTranslationApplier($repository, $storeManager, $state))->applyMany([$first, $second]); } }