OSDN Git Service

- added test for Ethna_ActionForm::setDef().
authorYoshinari Takaoka <mumumu@mumumu.org>
Fri, 16 Oct 2009 16:47:25 +0000 (01:47 +0900)
committerYoshinari Takaoka <mumumu@mumumu.org>
Fri, 16 Oct 2009 16:47:25 +0000 (01:47 +0900)
test/Ethna_ActionForm_Test.php

index f13b53a..e2f7385 100644 (file)
@@ -183,6 +183,25 @@ class Ethna_ActionForm_Test extends Ethna_UnitTestBase
     }
     // }}}
 
+    function test_setDef()
+    {
+        $orig = $this->local_af->getDef();
+
+        $def = array(
+            'name' => 'hoge test',
+            'type' => VAR_TYPE_STRING,
+            'form_type'=> FORM_TYPE_TEXT,
+            'required' => true,
+        );
+        $this->local_af->setDef('hoge', $def);
+
+        $this->assertEqual($def, $this->local_af->getDef('hoge'));
+
+        $this->local_af->setDef(null, $orig);
+        $this->assertEqual($this->local_af->form['test'], $this->local_af->getDef('test'));
+        $this->assertEqual($orig['test'], $this->local_af->getDef('test'));
+        $this->assertEqual($orig, $this->local_af->getDef());
+    }
 }
 // }}}