summaryrefslogtreecommitdiff
path: root/tests/www/searchTest.php
blob: e783a49ae761b468dfdd170b51e44442ef8d537f (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php

class www_SearchTest extends TestBaseApi
{
    protected $urlPart = 'search.php';


    /**
     * Some browsers using opensearch do "urlencode" on the terms,
     * for example Firefox. Multiple terms separated with space
     * appear as "foo+bar" in the URL.
     */
    public function testMultipleTermsUrlEncoded()
    {
        $this->addBookmark(null, null, 0, null, 'unittest foo bar');
        $res = $this->getRequest('/all/foo+bar')->send();
        $this->assertSelectCount(
            '.xfolkentry', true, $res->getBody(),
            'No bookmark found', false
        );

        $res = $this->getRequest('/all/baz+bat')->send();
        $this->assertSelectCount(
            '.xfolkentry', false, $res->getBody(),
            'Bookmarks found', false
        );
    }


    /**
     * Some browsers using opensearch do "rawurlencode" on the terms,
     * for example Opera. Multiple terms separated with space
     * appear as "foo%20bar" in the URL.
     */
    public function testMultipleTermsRawUrlEncoded()
    {
        $this->addBookmark(null, null, 0, null, 'unittest foo bar');
        $res = $this->getRequest('/all/foo bar')->send();
        $this->assertSelectCount(
            '.xfolkentry', true, $res->getBody(),
            'No bookmark found', false
        );

        $res = $this->getRequest('/all/baz bat')->send();
        $this->assertSelectCount(
            '.xfolkentry', false, $res->getBody(),
            'Bookmarks found', false
        );
    }

}

?>