2009-11-22 09:23:12 +01:00
|
|
|
<?php
|
2011-04-22 13:32:10 +02:00
|
|
|
class CMSMainSearchFormTest extends FunctionalTest {
|
2009-11-22 09:23:12 +01:00
|
|
|
|
2011-03-30 09:04:31 +02:00
|
|
|
static $fixture_file = '../controller/CMSMainTest.yml';
|
2009-11-22 09:23:12 +01:00
|
|
|
|
|
|
|
protected $autoFollowRedirection = false;
|
|
|
|
|
|
|
|
function testTitleFilter() {
|
|
|
|
$this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin'));
|
|
|
|
|
|
|
|
$response = $this->get(
|
2012-04-18 23:33:37 +02:00
|
|
|
'admin/pages/SearchForm/?' .
|
2009-11-22 09:23:12 +01:00
|
|
|
http_build_query(array(
|
2012-04-18 23:40:27 +02:00
|
|
|
'q' => array(
|
|
|
|
'Title' => 'Page 10',
|
|
|
|
'FilterClass' => 'CMSSiteTreeFilter_Search',
|
|
|
|
),
|
2011-04-22 13:32:10 +02:00
|
|
|
'action_doSearch' => true
|
2009-11-22 09:23:12 +01:00
|
|
|
))
|
|
|
|
);
|
2012-04-18 23:40:27 +02:00
|
|
|
|
2009-11-22 09:23:12 +01:00
|
|
|
$titles = $this->getPageTitles();
|
|
|
|
$this->assertEquals(count($titles), 1);
|
|
|
|
// For some reason the title gets split into two lines
|
|
|
|
|
|
|
|
$this->assertContains('Page 1', $titles[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getPageTitles() {
|
|
|
|
$titles = array();
|
|
|
|
$links = $this->cssParser()->getBySelector('li.class-Page a');
|
|
|
|
if($links) foreach($links as $link) {
|
|
|
|
$titles[] = preg_replace('/\n/', ' ', $link->asXML());
|
|
|
|
}
|
|
|
|
return $titles;
|
|
|
|
}
|
2012-04-12 09:23:20 +02:00
|
|
|
}
|