mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
e9b10e5b16
With additional modules like Translatable, this test fails because a 301 is issued to redirect the admin/pages/SearchForm request to the correct URL containining a locale in the query string.
36 lines
923 B
PHP
36 lines
923 B
PHP
<?php
|
|
class CMSMainSearchFormTest extends FunctionalTest {
|
|
|
|
protected static $fixture_file = '../controller/CMSMainTest.yml';
|
|
|
|
public function testTitleFilter() {
|
|
$this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin'));
|
|
|
|
$response = $this->get(
|
|
'admin/pages/SearchForm/?' .
|
|
http_build_query(array(
|
|
'q' => array(
|
|
'Title' => 'Page 10',
|
|
'FilterClass' => 'CMSSiteTreeFilter_Search',
|
|
),
|
|
'action_doSearch' => true
|
|
))
|
|
);
|
|
|
|
$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;
|
|
}
|
|
}
|