Easy and Quick Responsive Discover '; public function setUp() { parent::setUp(); $this->objectManager = GeneralUtility::makeInstance(ObjectManager::class); } /** * @test */ public function htmlIsReturnedForMjml() { // Mock extension to be active, to enable path fetching to call node binary. $packageMock = $this->getMockBuilder(Package::class) ->disableOriginalConstructor() ->getMock(); $packageMock->expects($this->any()) ->method('getPackagePath') ->willReturn(dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/'); $packageManagerMock = $this->getMockBuilder(PackageManager::class)->getMock(); $packageManagerMock->expects($this->any()) ->method('isPackageActive') ->with('mjml') ->willReturn(true); $packageManagerMock->expects($this->any()) ->method('getPackage') ->with('mjml') ->willReturn($packageMock); ExtensionManagementUtility::setPackageManager($packageManagerMock); $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['mjml'] = serialize([ 'nodeBinaryPath' => 'node', 'mjmlBinaryPath' => 'node_modules/mjml/bin/', 'mjmlBinary' => 'mjml', 'mjmlParams' => '-s --config.beautify true --config.minify true', ]); $subject = $this->objectManager->get(Command::class); $html = $subject->getHtmlFromMjml(static::EXAMPLE_MJML_TEMPLATE); // remove comment rendered by the outputToConsole https://github.com/mjmlio/mjml/blob/50b08513b7a651c234829abfde254f106a62c859/packages/mjml-cli/src/commands/outputToConsole.js#L4 $html = preg_replace('//Uis', '', $html); $this->assertStringEqualsFile( dirname(__FILE__) . '/CommandTestFixture/Expected.html', $html, 'Command renderer did not return expected HTML.' ); } }