diff --git a/test/View/Helper/FormElementErrorsTest.php b/test/View/Helper/FormElementErrorsTest.php index 92cbf798..4679c6c1 100644 --- a/test/View/Helper/FormElementErrorsTest.php +++ b/test/View/Helper/FormElementErrorsTest.php @@ -16,12 +16,23 @@ class FormElementErrorsTest extends CommonTestCase { + /** + * @var null|\Zend\Validator\Translator\TranslatorInterface + */ + protected $defaultTranslator; + public function setUp() { + $this->defaultTranslator = AbstractValidator::getDefaultTranslator(); $this->helper = new FormElementErrorsHelper(); parent::setUp(); } + public function tearDown() + { + AbstractValidator::setDefaultTranslator($this->defaultTranslator); + } + public function getMessageList() { return [ @@ -81,12 +92,10 @@ public function testRendersErrorMessagesUsingUnorderedListTranslated() public function testRendersErrorMessagesWithoutDoubleTranslation() { $form = new Form('test_form'); - $form->add( - [ - 'name' => 'test_element', - 'type' => Element\Color::class, - ] - ); + $form->add([ + 'name' => 'test_element', + 'type' => Element\Color::class, + ]); $form->setData(['test_element' => 'This is invalid!']); $mockValidatorTranslator = $this->createMock('Zend\Validator\Translator\TranslatorInterface'); @@ -121,9 +130,10 @@ function ($message) { $markup = $this->helper->render($form->get('test_element')); - // @codingStandardsIgnoreStart - $this->assertRegexp('##s', $markup); - // @codingStandardsIgnoreEnd + $this->assertRegexp( + '##s', + $markup + ); } public function testCanSpecifyAttributesForOpeningTag()