summaryrefslogtreecommitdiff
path: root/_test/tests/inc/form/form.test.php
blob: cdf3e5a3aa544c320a11a02d029d27a4a7399225 (plain)
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
<?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);
    }

}