Merge pull request #2576 from halkyon/fulltextsearch_test

FulltextSearchableTest doesn't clean up after itself.
This commit is contained in:
Ingo Schommer 2013-10-22 01:56:29 -07:00
commit f2d362b629

View File

@ -9,23 +9,22 @@ class FulltextSearchableTest extends SapphireTest {
public function setUp() {
parent::setUp();
$this->orig['File_searchable'] = File::has_extension('FulltextSearchable');
// TODO This shouldn't need all arguments included
File::remove_extension('FulltextSearchable(\'"Filename","Title","Content"\')');
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 tearDown() {
// TODO This shouldn't need all arguments included
if($this->orig['File_searchable']) {
File::add_extension('FulltextSearchable(\'"Filename","Title","Content"\')');
}
parent::tearDown();
File::remove_extension('FulltextSearchable');
Config::inst()->update('File', 'create_table_options', array('MySQLDatabase' => 'ENGINE=InnoDB'));
}
public function testEnable() {
FulltextSearchable::enable();
$this->assertTrue(File::has_extension('FulltextSearchable'));
}
@ -33,9 +32,7 @@ class FulltextSearchableTest extends SapphireTest {
FulltextSearchable::enable(array('File'));
$this->assertTrue(File::has_extension('FulltextSearchable'));
// TODO This shouldn't need all arguments included
File::remove_extension('FulltextSearchable(\'"Filename","Title","Content"\')');
File::remove_extension('FulltextSearchable');
$this->assertFalse(File::has_extension('FulltextSearchable'));
}