Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Progi1984 <[email protected]>
  • Loading branch information
2 people authored and marsaldev committed Apr 5, 2022
1 parent b8d2edd commit eed0581
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class GiftOptionsType extends TranslatorAwareType
/**
* @param TranslatorInterface $translator
* @param array $locales
* @param $defaultCurrencyIsoCode
* @param string $defaultCurrencyIsoCode
* @param array $taxChoices
* @param RouterInterface $router
*/
Expand Down
41 changes: 7 additions & 34 deletions tests/Unit/Adapter/MailTemplate/MailTemplateTwigRendererTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,7 @@ public function testConstructor()
->getMock()
;

$configurationMock = $this->getMockBuilder(ConfigurationInterface::class)
->disableOriginalConstructor()
->getMock()
;

$generator = new MailTemplateTwigRenderer($engineMock, $builderMock, $dispatcherMock, $configurationMock);
$generator = new MailTemplateTwigRenderer($engineMock, $builderMock, $dispatcherMock, false);
$this->assertNotNull($generator);
}

Expand Down Expand Up @@ -94,18 +89,13 @@ public function testFileNotFound()
->disableOriginalConstructor()
->getMock()
;
/** @var ConfigurationInterface $configurationMock */
$configurationMock = $this->getMockBuilder(ConfigurationInterface::class)
->disableOriginalConstructor()
->getMock()
;

/** @var Environment $engineMock */
$generator = new MailTemplateTwigRenderer(
$engineMock,
$this->createVariablesBuilderMock($expectedVariables, $expectedLanguage),
$dispatcherMock,
$configurationMock
false
);
$this->assertNotNull($generator);

Expand All @@ -126,7 +116,7 @@ public function testRenderHtml(): void
$this->createEngineMock($templatePaths[MailTemplateInterface::HTML_TYPE], $expectedVariables, $expectedTemplate),
$this->createVariablesBuilderMock($expectedVariables, $expectedLanguage),
$this->createHookDispatcherMock($mailLayout, MailTemplateInterface::HTML_TYPE),
$this->createConfigurationMock()
true
);
$this->assertNotNull($generator);

Expand All @@ -149,7 +139,7 @@ public function testRenderHtmlWithFallback(): void
$this->createEngineMock($templatePaths[MailTemplateInterface::TXT_TYPE], $expectedVariables, $expectedTemplate),
$this->createVariablesBuilderMock($expectedVariables, $expectedLanguage),
$this->createHookDispatcherMock($mailLayout, MailTemplateInterface::HTML_TYPE),
$this->createConfigurationMock()
true
);
$this->assertNotNull($generator);

Expand All @@ -171,7 +161,7 @@ public function testRenderTxt(): void
$this->createEngineMock($templatePaths[MailTemplateInterface::TXT_TYPE], $expectedVariables, $expectedTemplate),
$this->createVariablesBuilderMock($expectedVariables, $expectedLanguage),
$this->createHookDispatcherMock($mailLayout, MailTemplateInterface::TXT_TYPE),
$this->createConfigurationMock()
true
);
$this->assertNotNull($generator);

Expand All @@ -194,7 +184,7 @@ public function testRenderTxtFallback()
$this->createEngineMock($templatePaths[MailTemplateInterface::HTML_TYPE], $expectedVariables, $expectedTemplate),
$this->createVariablesBuilderMock($expectedVariables, $expectedLanguage),
$this->createHookDispatcherMock($mailLayout, MailTemplateInterface::TXT_TYPE),
$this->createConfigurationMock()
true
);
$this->assertNotNull($generator);

Expand All @@ -217,7 +207,7 @@ public function testRenderWithTransformations()
$this->createEngineMock($templatePaths[MailTemplateInterface::HTML_TYPE], $expectedVariables, $generatedTemplate),
$this->createVariablesBuilderMock($expectedVariables, $expectedLanguage),
$this->createHookDispatcherMock($mailLayout, MailTemplateInterface::HTML_TYPE, 1),
$this->createConfigurationMock()
true
);
$this->assertNotNull($generator);

Expand Down Expand Up @@ -395,21 +385,4 @@ private function createMailLayoutMock(array $expectedPaths)

return $mailLayoutMock;
}

/**
* @return MockObject|ConfigurationInterface
*/
private function createConfigurationMock()
{
$configurationMock = $this->getMockBuilder(ConfigurationInterface::class)
->disableOriginalConstructor()
->getMock()
;

$configurationMock
->method('get')
->willReturn(1);

return $configurationMock;
}
}

0 comments on commit eed0581

Please sign in to comment.