'submit', 'name' => 'Submit', 'id' => 'submit', 'unique' => '1', 'static' => '0', 'params' => [ 'label' => 'Submit label', ], 'position' => '1', ]; public function _before() { parent::_before(); $this->rendererHelperMock = $this->createMock(BlockRendererHelper::class); $this->wrapperMock = $this->createMock(BlockWrapperRenderer::class); $this->wrapperMock->method('render')->will($this->returnArgument(1)); $this->stylesRendererMock = $this->createMock(BlockStylesRenderer::class); $this->submit = new Submit($this->rendererHelperMock, $this->wrapperMock, $this->stylesRendererMock); $this->htmlParser = new HtmlParser(); } public function testItShouldRenderSubmit() { $this->rendererHelperMock->expects($this->once())->method('getFieldLabel')->willReturn('Submit label'); $this->stylesRendererMock->expects($this->once())->method('renderForButton')->willReturn('border-radius: 10px;'); $html = $this->submit->render($this->block, []); $input = $this->htmlParser->getElementByXpath($html, '//input'); $type = $this->htmlParser->getAttribute($input, 'type'); $value = $this->htmlParser->getAttribute($input, 'value'); $style = $this->htmlParser->getAttribute($input, 'style'); expect($type->value)->equals('submit'); expect($value->value)->equals('Submit label'); expect($style->value)->equals('border-radius: 10px;'); } }