2011-03-22 10:00:53 +01:00
|
|
|
<?php
|
|
|
|
class ContentControllerSearchExtensionTest extends SapphireTest {
|
2013-10-22 04:21:46 +02:00
|
|
|
|
2012-09-19 12:07:46 +02:00
|
|
|
public function testCustomSearchFormClassesToTest() {
|
2011-03-22 10:00:53 +01:00
|
|
|
$page = new Page();
|
|
|
|
$page->URLSegment = 'whatever';
|
|
|
|
$page->Content = 'oh really?';
|
|
|
|
$page->write();
|
|
|
|
$page->publish('Stage', 'Live');
|
|
|
|
$controller = new ContentController($page);
|
|
|
|
$form = $controller->SearchForm();
|
|
|
|
|
|
|
|
if (get_class($form) == 'SearchForm') $this->assertEquals(array('File'), $form->getClassesToSearch());
|
|
|
|
}
|
2013-10-22 04:21:46 +02:00
|
|
|
|
|
|
|
public function setUpOnce() {
|
|
|
|
parent::setUpOnce();
|
|
|
|
|
|
|
|
FulltextSearchable::enable('File');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* FulltextSearchable::enable() leaves behind remains that don't get cleaned up
|
|
|
|
* properly at the end of the test. This becomes apparent when a later test tries to
|
|
|
|
* ALTER TABLE File and add fulltext indexes with the InnoDB table type.
|
|
|
|
*/
|
|
|
|
public function tearDownOnce() {
|
|
|
|
parent::tearDownOnce();
|
|
|
|
|
|
|
|
Config::inst()->update('File', 'create_table_options', array('MySQLDatabase' => 'ENGINE=InnoDB'));
|
|
|
|
File::remove_extension('FulltextSearchable');
|
|
|
|
}
|
|
|
|
|
2012-04-12 09:23:20 +02:00
|
|
|
}
|