2011-04-15 07:55:06 +02:00
|
|
|
<?php
|
2011-06-08 04:13:50 +02:00
|
|
|
require_once dirname(__FILE__) . '/../prepare.php';
|
|
|
|
require_once 'HTTP/Request2.php';
|
2011-04-15 07:55:06 +02:00
|
|
|
|
|
|
|
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(),
|
2011-04-15 07:56:50 +02:00
|
|
|
'No bookmark found', false
|
2011-04-15 07:55:06 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
$res = $this->getRequest('/all/baz+bat')->send();
|
|
|
|
$this->assertSelectCount(
|
|
|
|
'.xfolkentry', false, $res->getBody(),
|
2011-04-15 07:56:50 +02:00
|
|
|
'Bookmarks found', false
|
2011-04-15 07:55:06 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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');
|
2011-04-15 08:00:26 +02:00
|
|
|
$res = $this->getRequest('/all/foo%20bar')->send();
|
2011-04-15 07:55:06 +02:00
|
|
|
$this->assertSelectCount(
|
|
|
|
'.xfolkentry', true, $res->getBody(),
|
2011-04-15 07:56:50 +02:00
|
|
|
'No bookmark found', false
|
2011-04-15 07:55:06 +02:00
|
|
|
);
|
|
|
|
|
2011-05-20 17:08:39 +02:00
|
|
|
$res = $this->getRequest('/all/baz%20bat')->send();
|
2011-04-15 07:55:06 +02:00
|
|
|
$this->assertSelectCount(
|
|
|
|
'.xfolkentry', false, $res->getBody(),
|
2011-04-15 07:56:50 +02:00
|
|
|
'Bookmarks found', false
|
2011-04-15 07:55:06 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2011-04-15 19:15:57 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2011-04-15 07:55:06 +02:00
|
|
|
}
|
|
|
|
|
2011-06-08 04:13:50 +02:00
|
|
|
?>
|