Skip to content
Permalink
Browse files

adds two tests for the method type and form options

  • Loading branch information...
TheFRedFox committed Apr 13, 2016
1 parent dcd7f88 commit 7ab006d02d71875833676d88e4ca5fc0881bd1ba
Showing with 32 additions and 0 deletions.
  1. +32 −0 tests/TestCase/View/Helper/FormHelperTest.php
@@ -6804,6 +6804,38 @@ public function testPostButton()
$this->assertTrue(strpos($result, '<input type="hidden" name="extra" value="value"') !== false);
}
public function testPostButtonMethodType()
{
$result = $this->Form->postButton('Hi', '/controller/action', ['method' => 'patch']);
$expected = [
'form' => ['method' => 'post', 'action' => '/controller/action', 'accept-charset' => 'utf-8'],
'div' => ['style' => 'display:none;'],
'input' => ['type' => 'hidden', 'name' => '_method', 'value' => 'PATCH'],
'/div',
'button' => ['type' => 'submit'],
'Hi',
'/button',
'/form'
];
$this->assertHtml($expected, $result);
}
public function testPostButtonFormOptions()
{
$result = $this->Form->postButton('Hi', '/controller/action', ['form' => ['class' => 'inline']]);
$expected = [
'form' => ['method' => 'post', 'action' => '/controller/action', 'accept-charset' => 'utf-8', 'class' => 'inline'],
'div' => ['style' => 'display:none;'],
'input' => ['type' => 'hidden', 'name' => '_method', 'value' => 'POST'],
'/div',
'button' => ['type' => 'submit'],
'Hi',
'/button',
'/form'
];
$this->assertHtml($expected, $result);
}
/**
* Test using postButton with N dimensional data.
*

0 comments on commit 7ab006d

Please sign in to comment.
You can’t perform that action at this time.