jsTranslationConfig = $this->createPartialMock(JsTranslationConfig::class, ['getDictionaryFileName']); $this->jsTranslationConfig ->expects($this->exactly(2)) ->method('getDictionaryFileName') ->willReturn($dictionary); $this->deployStaticFile = $this->getMockBuilder(DeployStaticFile::class) ->disableOriginalConstructor() ->setMethods(['deployFile']) ->getMock(); $this->deployStaticFile->expects($this->exactly(1))->method('deployFile') ->willReturnCallback( function ($checkDictionary, $params) use ($dictionary, $area, $theme, $locale) { $this->assertEquals($dictionary, $checkDictionary); $this->assertEquals($dictionary, $params['fileName']); $this->assertEquals($area, $params['area']); $this->assertEquals($theme, $params['theme']); $this->assertEquals($locale, $params['locale']); } ); $this->state = $this->getMockBuilder(State::class) ->disableOriginalConstructor() ->setMethods(['emulateAreaCode']) ->getMock(); $this->state->expects($this->exactly(1))->method('emulateAreaCode') ->willReturnCallback( function ($area, $callback) { $this->assertEquals('adminhtml', $area); $callback(); } ); $this->logger = $this->getMockForAbstractClass( LoggerInterface::class, [], '', false ); $this->service = new DeployTranslationsDictionary( $this->jsTranslationConfig, $this->deployStaticFile, $this->state, $this->logger ); } /** * @see DeployTranslationsDictionary::deploy() */ public function testDeploy() { $area = 'adminhtml'; $theme = 'Magento/backend'; $locale = 'uk_UA'; $this->service->deploy($area, $theme, $locale); } }