public function setUp() { $this->publishingService = new PublishingService(); $this->mockWorkspaceRepository = $this->getMockBuilder(WorkspaceRepository::class)->disableOriginalConstructor()->setMethods(array('findOneByName'))->getMock(); $this->inject($this->publishingService, 'workspaceRepository', $this->mockWorkspaceRepository); $this->mockNodeDataRepository = $this->getMockBuilder(NodeDataRepository::class)->disableOriginalConstructor()->setMethods(array('findByWorkspace'))->getMock(); $this->inject($this->publishingService, 'nodeDataRepository', $this->mockNodeDataRepository); $this->mockNodeFactory = $this->getMockBuilder(NodeFactory::class)->disableOriginalConstructor()->getMock(); $this->inject($this->publishingService, 'nodeFactory', $this->mockNodeFactory); $this->mockContextFactory = $this->getMockBuilder(ContextFactoryInterface::class)->disableOriginalConstructor()->getMock(); $this->inject($this->publishingService, 'contextFactory', $this->mockContextFactory); $this->mockBaseWorkspace = $this->getMockBuilder(Workspace::class)->disableOriginalConstructor()->getMock(); $this->mockBaseWorkspace->expects($this->any())->method('getName')->will($this->returnValue('live')); $this->mockBaseWorkspace->expects($this->any())->method('getBaseWorkspace')->will($this->returnValue(null)); $this->mockContentDimensionPresetSource = $this->getMockBuilder(ContentDimensionPresetSourceInterface::class)->disableOriginalConstructor()->getMock(); $this->mockContentDimensionPresetSource->expects($this->any())->method('findPresetsByTargetValues')->will($this->returnArgument(0)); $this->inject($this->publishingService, 'contentDimensionPresetSource', $this->mockContentDimensionPresetSource); $this->mockWorkspace = $this->getMockBuilder(Workspace::class)->disableOriginalConstructor()->getMock(); $this->mockWorkspace->expects($this->any())->method('getName')->will($this->returnValue('workspace-name')); $this->mockWorkspace->expects($this->any())->method('getBaseWorkspace')->will($this->returnValue($this->mockBaseWorkspace)); }