forked from oreillymedia/Learning_PHP
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathButtonValidationTest.php
More file actions
39 lines (38 loc) · 1.36 KB
/
Copy pathButtonValidationTest.php
File metadata and controls
39 lines (38 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
// RUNNER STUB START
include 'ValidatingFormHelper.php';
class ButtonValidationTest extends PHPUnit_Framework_TestCase {
public function setUp() {
$_SERVER['REQUEST_METHOD'] = 'GET';
}
// RUNNER STUB END
public function testButtonNoTypeOK() {
$form = new FormHelper();
$html = $form->tag('button');
$this->assertEquals('<button />',$html);
}
public function testButtonTypeSubmitOK() {
$form = new FormHelper();
$html = $form->tag('button',['type'=>'submit']);
$this->assertEquals('<button type="submit" />',$html);
}
public function testButtonTypeResetOK() {
$form = new FormHelper();
$html = $form->tag('button',['type'=>'reset']);
$this->assertEquals('<button type="reset" />',$html);
}
public function testButtonTypeButtonOK() {
$form = new FormHelper();
$html = $form->tag('button',['type'=>'button']);
$this->assertEquals('<button type="button" />',$html);
}
public function testButtonTypeOtherFails() {
$form = new FormHelper();
// FormHelper에 잘못된 속성이 입력되면
// InvalidArgumentException가 발생되어야 한다.
$this->setExpectedException('InvalidArgumentException');
$html = $form->tag('button',['type'=>'other']);
}
// RUNNER STUB START
}
// RUNNER STUB END