diff --git a/Classes/Domain/Renderer/Command.php b/Classes/Domain/Renderer/Command.php index 0dab6bd..b6ec2f9 100644 --- a/Classes/Domain/Renderer/Command.php +++ b/Classes/Domain/Renderer/Command.php @@ -6,7 +6,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; class Command implements RendererInterface { - protected function getHtmlFromMjml($mjml) + public function getHtmlFromMjml($mjml) { $configuration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['mjml']); diff --git a/Tests/Unit/Domain/Renderer/CommandTest.php b/Tests/Unit/Domain/Renderer/CommandTest.php new file mode 100644 index 0000000..aa7a7fb --- /dev/null +++ b/Tests/Unit/Domain/Renderer/CommandTest.php @@ -0,0 +1,66 @@ + + + + + + + Easy and Quick + + + + Responsive + + + + + Discover + + + + + +'; + + public function setUp() + { + parent::setUp(); + $this->objectManager = GeneralUtility::makeInstance(ObjectManager::class); + } + + /** + * @test + */ + public function htmlIsReturnedForMjml() + { + $expectedHtml = '
Easy and Quick
Responsive

Discover

'; + $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['mjml'] = serialize([ + 'nodeBinaryPath' => 'node', + 'mjmlBinaryPath' => 'node_modules/.bin/', + 'mjmlBinary' => 'mjml', + 'mjmlParams' => '-s -m', + ]); + + $subject = $this->objectManager->get(Command::class); + $html = $subject->getHtmlFromMjml(static::EXAMPLE_MJML_TEMPLATE); + $this->assertSame( + $expectedHtml, + $html, + 'Command renderer did not return expected HTML.' + ); + } +} diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 0455ed1..f8dad0b 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -16,13 +16,13 @@ - ./Tests/Unit/ + ./Tests/Unit - Classes + ./Classes