diff --git a/tests/unit/Form/Block/SubmitTest.php b/tests/unit/Form/Block/SubmitTest.php new file mode 100644 index 0000000000..becb4928d6 --- /dev/null +++ b/tests/unit/Form/Block/SubmitTest.php @@ -0,0 +1,50 @@ + 'submit', + 'name' => 'Submit', + 'id' => 'submit', + 'unique' => '1', + 'static' => '0', + 'params' => [ + 'label' => 'Submit label', + ], + 'position' => '1', + ]; + + public function _before() { + parent::_before(); + $this->baseMock = $this->createMock(Base::class); + $this->submit = new Submit($this->baseMock); + $this->htmlParser = new HtmlParser(); + } + + public function testItShouldRenderSubmit() { + $this->baseMock->expects($this->once())->method('getFieldLabel')->willReturn('Submit label'); + $html = $this->submit->render($this->block); + $input = $this->htmlParser->getElementByXpath($html, '//input'); + $type = $this->htmlParser->getAttribute($input, 'type'); + $value = $this->htmlParser->getAttribute($input, 'value'); + expect($type->value)->equals('submit'); + expect($value->value)->equals('Submit label'); + } +}