diff options
author | Andreas Gohr <andi@splitbrain.org> | 2015-05-08 17:26:11 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2015-05-08 17:26:11 +0200 |
commit | 6d0ceaf93ca31dfb83fd4325ef2eecd9cef733c0 (patch) | |
tree | 468e38161d822e90e7d8f5b27d333273966fd890 /_test/tests/inc/form/form.test.php | |
parent | e7a32b176701c088bab045437819448bb9adad41 (diff) | |
download | rpg-6d0ceaf93ca31dfb83fd4325ef2eecd9cef733c0.tar.gz rpg-6d0ceaf93ca31dfb83fd4325ef2eecd9cef733c0.tar.bz2 |
added a first few tests.
this is far from comprehensible, but should give an idea how the new
library works and how to write tests
Diffstat (limited to '_test/tests/inc/form/form.test.php')
-rw-r--r-- | _test/tests/inc/form/form.test.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/_test/tests/inc/form/form.test.php b/_test/tests/inc/form/form.test.php index e69de29bb..cdf3e5a3a 100644 --- a/_test/tests/inc/form/form.test.php +++ b/_test/tests/inc/form/form.test.php @@ -0,0 +1,28 @@ +<?php + +use dokuwiki\Form; + +class form_form_test extends DokuWikiTest { + + /** + * checks that an empty form is initialized correctly + */ + function test_defaults() { + global $INPUT; + global $ID; + $ID = 'some:test'; + $INPUT->get->set('id', $ID); + $INPUT->get->set('foo', 'bar'); + + $form = new Form\Form(); + $html = $form->toHTML(); + $pq = phpQuery::newDocumentXHTML($html); + + $this->assertTrue($pq->find('form')->hasClass('doku_form')); + $this->assertEquals(wl($ID, array('foo' => 'bar'), false, '&'), $pq->find('form')->attr('action')); + $this->assertEquals('post', $pq->find('form')->attr('method')); + + $this->assertTrue($pq->find('input[name=sectok]')->length == 1); + } + +} |