Skip to content

Commit e99a0a0

Browse files
committed
Merge pull request adamwathan#54 from bmullican/add_patch_method
Added patch method and test
2 parents f6d10d7 + cb69833 commit e99a0a0

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/AdamWathan/Form/Elements/FormOpen.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ public function put()
5454
return $this->setHiddenMethod('PUT');
5555
}
5656

57+
public function patch()
58+
{
59+
return $this->setHiddenMethod('PATCH');
60+
}
61+
5762
public function delete()
5863
{
5964
return $this->setHiddenMethod('DELETE');

tests/FormOpenTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ public function testRenderPutFormOpen()
4545
$this->assertEquals($expected, $result);
4646
}
4747

48+
public function testRenderPatchFormOpen()
49+
{
50+
$form = new FormOpen;
51+
$expected = '<form method="POST" action=""><input type="hidden" name="_method" value="PATCH">';
52+
$result = $form->patch()->render();
53+
54+
$this->assertEquals($expected, $result);
55+
}
56+
4857
public function testRenderDeleteFormOpen()
4958
{
5059
$form = new FormOpen;

0 commit comments

Comments
 (0)