Skip to content

Commit

Permalink
adds two tests for the method type and form options
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFRedFox committed May 30, 2016
1 parent dcd7f88 commit 7ab006d
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/TestCase/View/Helper/FormHelperTest.php
Expand Up @@ -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.
*
Expand Down

0 comments on commit 7ab006d

Please sign in to comment.