@ -2,7 +2,7 @@
require_once(LIB_PATH . '/lib_date.php');
class SearchTest extends \PHPUnit_Framework_ TestCase {
class SearchTest extends PHPUnit\Framework\ TestCase {
/**
* @dataProvider provideEmptyInput
@ -50,22 +50,22 @@ class SearchTest extends \PHPUnit_Framework_TestCase {
*/
public function provideIntitleSearch() {
return array(
array('intitle:word1', 'word1', null),
array('intitle:word1 word2', 'word1', array('word2')),
array('intitle:"word1 word2"', 'word1 word2', null),
array("intitle:'word1 word2'", 'word1 word2', null),
array('word1 intitle:word2', 'word2', array('word1')),
array('word1 intitle:word2 word3', 'word2', array('word1', 'word3')),
array('word1 intitle:"word2 word3"', 'word2 word3', array('word1')),
array("word1 intitle:'word2 word3'", 'word2 word3', array('word1')),
array('intitle:word1 intitle:word2', 'word1', array( 'intitle: word2')),
array('intitle: word1 word2', null , array('word1', 'word2')),
array('intitle:123', '123', null),
array('intitle:"word1 word2" word3"', 'word1 word2', array('word3"')),
array("intitle:'word1 word2' word3'", 'word1 word2', array("word3'")),
array('intitle:"word1 word2\' word3"', "word1 word2' word3", null),
array("intitle:'word1 word2\" word3'", 'word1 word2" word3', null),
array("intitle:word1 'word2 word3' word4", 'word1', array('word2 word3', 'word4')),
array('intitle:word1', array( 'word1') , null),
array('intitle:word1 word2', array( 'word1') , array('word2')),
array('intitle:"word1 word2"', array( 'word1 word2') , null),
array("intitle:'word1 word2'", array( 'word1 word2') , null),
array('word1 intitle:word2', array( 'word2') , array('word1')),
array('word1 intitle:word2 word3', array( 'word2') , array('word1', 'word3')),
array('word1 intitle:"word2 word3"', array( 'word2 word3') , array('word1')),
array("word1 intitle:'word2 word3'", array( 'word2 word3') , array('word1')),
array('intitle:word1 intitle:word2', array( 'word1', 'word2'), null ),
array('intitle: word1 word2', array() , array('word1', 'word2')),
array('intitle:123', array( '123') , null),
array('intitle:"word1 word2" word3"', array( 'word1 word2') , array('word3"')),
array("intitle:'word1 word2' word3'", array( 'word1 word2') , array("word3'")),
array('intitle:"word1 word2\' word3"', array( "word1 word2' word3") , null),
array("intitle:'word1 word2\" word3'", array( 'word1 word2" word3') , null),
array("intitle:word1 'word2 word3' word4", array( 'word1') , array('word2 word3', 'word4')),
);
}
@ -86,22 +86,22 @@ class SearchTest extends \PHPUnit_Framework_TestCase {
*/
public function provideAuthorSearch() {
return array(
array('author:word1', 'word1', null),
array('author:word1 word2', 'word1', array('word2')),
array('author:"word1 word2"', 'word1 word2', null),
array("author:'word1 word2'", 'word1 word2', null),
array('word1 author:word2', 'word2', array('word1')),
array('word1 author:word2 word3', 'word2', array('word1', 'word3')),
array('word1 author:"word2 word3"', 'word2 word3', array('word1')),
array("word1 author:'word2 word3'", 'word2 word3', array('word1')),
array('author:word1 author:word2', 'word1', array( 'author: word2')),
array('author: word1 word2', null , array('word1', 'word2')),
array('author:123', '123', null),
array('author:"word1 word2" word3"', 'word1 word2', array('word3"')),
array("author:'word1 word2' word3'", 'word1 word2', array("word3'")),
array('author:"word1 word2\' word3"', "word1 word2' word3", null),
array("author:'word1 word2\" word3'", 'word1 word2" word3', null),
array("author:word1 'word2 word3' word4", 'word1', array('word2 word3', 'word4')),
array('author:word1', array( 'word1') , null),
array('author:word1 word2', array( 'word1') , array('word2')),
array('author:"word1 word2"', array( 'word1 word2') , null),
array("author:'word1 word2'", array( 'word1 word2') , null),
array('word1 author:word2', array( 'word2') , array('word1')),
array('word1 author:word2 word3', array( 'word2') , array('word1', 'word3')),
array('word1 author:"word2 word3"', array( 'word2 word3') , array('word1')),
array("word1 author:'word2 word3'", array( 'word2 word3') , array('word1')),
array('author:word1 author:word2', array( 'word1', 'word2'), null ),
array('author: word1 word2', array() , array('word1', 'word2')),
array('author:123', array( '123') , null),
array('author:"word1 word2" word3"', array( 'word1 word2') , array('word3"')),
array("author:'word1 word2' word3'", array( 'word1 word2') , array("word3'")),
array('author:"word1 word2\' word3"', array( "word1 word2' word3") , null),
array("author:'word1 word2\" word3'", array( 'word1 word2" word3') , null),
array("author:word1 'word2 word3' word4", array( 'word1') , array('word2 word3', 'word4')),
);
}
@ -122,12 +122,13 @@ class SearchTest extends \PHPUnit_Framework_TestCase {
*/
public function provideInurlSearch() {
return array(
array('inurl:word1', 'word1', null),
array('inurl: word1', null, array('word1')),
array('inurl:123', '123', null),
array('inurl:word1 word2', 'word1', array('word2')),
array('inurl:"word1 word2"', '"word1', array('word2"')),
array("inurl:word1 'word2 word3' word4", 'word1', array('word2 word3', 'word4')),
array('inurl:word1', array('word1'), null),
array('inurl: word1', array(), array('word1')),
array('inurl:123', array('123'), null),
array('inurl:word1 word2', array('word1'), array('word2')),
array('inurl:"word1 word2"', array('"word1'), array('word2"')),
array('inurl:word1 word2 inurl:word3', array('word1', 'word3'), array('word2')),
array("inurl:word1 'word2 word3' word4", array('word1'), array('word2 word3', 'word4')),
);
}
@ -151,9 +152,9 @@ class SearchTest extends \PHPUnit_Framework_TestCase {
array('date:2007-03-01T13:00:00Z/2008-05-11T15:30:00Z', '1172754000', '1210519800'),
array('date:2007-03-01T13:00:00Z/P1Y2M10DT2H30M', '1172754000', '1210516199'),
array('date:P1Y2M10DT2H30M/2008-05-11T15:30:00Z', '1172757601', '1210519800'),
array('date:2007-03-01/2008-05-11', '1172725200', '1210564799' ),
array('date:2007-03-01/', '1172725200' , ''),
array('date:/2008-05-11', '', '1210564799' ),
array('date:2007-03-01/2008-05-11', strtotime('2007-03-01'), strtotime('2008-05-12') - 1 ),
array('date:2007-03-01/', strtotime('2007-03-01') , ''),
array('date:/2008-05-11', '', strtotime('2008-05-12') - 1 ),
);
}
@ -177,9 +178,9 @@ class SearchTest extends \PHPUnit_Framework_TestCase {
array('pubdate:2007-03-01T13:00:00Z/2008-05-11T15:30:00Z', '1172754000', '1210519800'),
array('pubdate:2007-03-01T13:00:00Z/P1Y2M10DT2H30M', '1172754000', '1210516199'),
array('pubdate:P1Y2M10DT2H30M/2008-05-11T15:30:00Z', '1172757601', '1210519800'),
array('pubdate:2007-03-01/2008-05-11', '1172725200', '1210564799' ),
array('pubdate:2007-03-01/', '1172725200' , ''),
array('pubdate:/2008-05-11', '', '1210564799' ),
array('pubdate:2007-03-01/2008-05-11', strtotime('2007-03-01'), strtotime('2008-05-12') - 1 ),
array('pubdate:2007-03-01/', strtotime('2007-03-01') , ''),
array('pubdate:/2008-05-11', '', strtotime('2008-05-12') - 1 ),
);
}
@ -201,7 +202,7 @@ class SearchTest extends \PHPUnit_Framework_TestCase {
public function provideTagsSearch() {
return array(
array('#word1', array('word1'), null),
array('# word1', null , array('#', 'word1')),
array('# word1', array() , array('#', 'word1')),
array('#123', array('123'), null),
array('#word1 word2', array('word1'), array('word2')),
array('#"word1 word2"', array('"word1'), array('word2"')),
@ -241,49 +242,49 @@ class SearchTest extends \PHPUnit_Framework_TestCase {
return array(
array(
'author:word1 date:2007-03-01/2008-05-11 intitle:word2 inurl:word3 pubdate:2007-03-01/2008-05-11 #word4 #word5',
'word1',
'1172725200' ,
'1210564799' ,
'word2',
'word3',
'1172725200' ,
'1210564799' ,
array( 'word1') ,
strtotime('2007-03-01') ,
strtotime('2008-05-12') - 1 ,
array( 'word2') ,
array( 'word3') ,
strtotime('2007-03-01') ,
strtotime('2008-05-12') - 1 ,
array('word4', 'word5'),
null,
),
array(
'word6 intitle:word2 inurl:word3 pubdate:2007-03-01/2008-05-11 #word4 author:word1 #word5 date:2007-03-01/2008-05-11',
'word1',
'1172725200' ,
'1210564799' ,
'word2',
'word3',
'1172725200' ,
'1210564799' ,
array( 'word1') ,
strtotime('2007-03-01') ,
strtotime('2008-05-12') - 1 ,
array( 'word2') ,
array( 'word3') ,
strtotime('2007-03-01') ,
strtotime('2008-05-12') - 1 ,
array('word4', 'word5'),
array('word6'),
),
array(
'word6 intitle:word2 inurl:word3 pubdate:2007-03-01/2008-05-11 #word4 author:word1 #word5 word7 date:2007-03-01/2008-05-11',
'word1',
'1172725200' ,
'1210564799' ,
'word2',
'word3',
'1172725200' ,
'1210564799' ,
array( 'word1') ,
strtotime('2007-03-01') ,
strtotime('2008-05-12') - 1 ,
array( 'word2') ,
array( 'word3') ,
strtotime('2007-03-01') ,
strtotime('2008-05-12') - 1 ,
array('word4', 'word5'),
array('word6', 'word7'),
),
array(
'word6 intitle:word2 inurl:word3 pubdate:2007-03-01/2008-05-11 #word4 author:word1 #word5 "word7 word8" date:2007-03-01/2008-05-11',
'word1',
'1172725200' ,
'1210564799' ,
'word2',
'word3',
'1172725200' ,
'1210564799' ,
array( 'word1') ,
strtotime('2007-03-01') ,
strtotime('2008-05-12') - 1 ,
array( 'word2') ,
array( 'word3') ,
strtotime('2007-03-01') ,
strtotime('2008-05-12') - 1 ,
array('word4', 'word5'),
array('word7 word8', 'word6'),
),