3 * Ethna_ViewClass_FormHelper_Test.php
6 * @author Yoshinari Takaoka <takaoka@beatcraft.com>
9 require_once ETHNA_INSTALL_BASE . '/test/Ethna_MockProject.php';
12 * Ethna_ViewClass のうち、フォームヘルパ
16 * @author Yoshinari Takaoka <takaoka@beatcraft.com>
19 class Ethna_ViewClass_FormHelper_Test extends Ethna_UnitTestBase
25 $this->project =& new Ethna_MockProject();
26 $this->project->create();
31 $this->project->delete();
32 unset($GLOBALS['_Ethna_controller']);
35 function test_formhelper_Text()
37 $action_name = $tpl_name = 'texttest';
38 $action_skel = ETHNA_TEST_SKELDIR . 'skel.action.formhelper.php';
39 $this->project->runCmd('add-action',
46 $tpl_skel = ETHNA_TEST_SKELTPLDIR . 'skel.template.text.tpl';
47 $this->project->runCmd('add-template',
54 $submit_value = array(
55 'text_setactval' => 'abcd',
57 $result = $this->project->runMain($action_name, $submit_value);
58 $this->assertPattern('#<input type="text" name="text_noval" value="" />#', $result);
59 $this->assertPattern('#<input type="text" name="text_setactval" value="abcd" />#', $result);
60 $this->assertPattern('#<input value="1234" type="text" name="text_settplval" />#', $result);
63 function test_formhelper_Textarea()
65 $action_name = $tpl_name = 'textareatest';
66 $action_skel = ETHNA_TEST_SKELDIR . 'skel.action.formhelper.php';
67 $this->project->runCmd('add-action',
74 $tpl_skel = ETHNA_TEST_SKELTPLDIR . 'skel.template.textarea.tpl';
75 $this->project->runCmd('add-template',
82 $submit_value = array(
83 'textarea_setactval' => 'input',
85 $result = $this->project->runMain($action_name, $submit_value);
87 $this->assertPattern('#<textarea name="textarea_noval"></textarea>#', $result);
88 $this->assertPattern('#<textarea name="textarea_setactval">input</textarea>#', $result);
89 $this->assertPattern('#<textarea value="foo" name="textarea_settplval">foo</textarea>#', $result);