aboutsummaryrefslogtreecommitdiff
path: root/tests/www/searchTest.php
blob: 5dce69d01b4cbdfd8ecad7ac29595dfe27f03059 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?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%20bar')->send();
        $this->assertSelectCount(
            '.xfolkentry', true, $res->getBody(),
            'No bookmark found', false
        );

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


    public function testMultipleTags()
    {
        $this->markTestSkipped(
            'FIXME: SemanticScuttle currently does not search multiple tags'
        );

        $this->addBookmark(null, null, 0, array('foo', 'bar'));
        $res = $this->getRequest('/all/foo+bar')->send();
        $this->assertSelectCount(
            '.xfolkentry', true, $res->getBody(),
            'No bookmark found', false
        );
    }

}

?>