mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
FulltextSearchableTest doesn't clean up after itself.
The extension doesn't get unloaded correctly at the end of the test, resulting in tests afterwards sometimes failing because the table type is reset back to InnoDB. See silverstripe/silverstripe-cms ed8ee4e9b for a similar fix done in the cms module.
This commit is contained in:
parent
d3b5b11942
commit
acaf0e40cc
@ -9,23 +9,22 @@ class FulltextSearchableTest extends SapphireTest {
|
|||||||
public function setUp() {
|
public function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->orig['File_searchable'] = File::has_extension('FulltextSearchable');
|
FulltextSearchable::enable('File');
|
||||||
|
|
||||||
// TODO This shouldn't need all arguments included
|
|
||||||
File::remove_extension('FulltextSearchable(\'"Filename","Title","Content"\')');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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() {
|
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();
|
parent::tearDown();
|
||||||
|
|
||||||
|
File::remove_extension('FulltextSearchable');
|
||||||
|
Config::inst()->update('File', 'create_table_options', array('MySQLDatabase' => 'ENGINE=InnoDB'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testEnable() {
|
public function testEnable() {
|
||||||
FulltextSearchable::enable();
|
|
||||||
$this->assertTrue(File::has_extension('FulltextSearchable'));
|
$this->assertTrue(File::has_extension('FulltextSearchable'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,9 +32,7 @@ class FulltextSearchableTest extends SapphireTest {
|
|||||||
FulltextSearchable::enable(array('File'));
|
FulltextSearchable::enable(array('File'));
|
||||||
$this->assertTrue(File::has_extension('FulltextSearchable'));
|
$this->assertTrue(File::has_extension('FulltextSearchable'));
|
||||||
|
|
||||||
// TODO This shouldn't need all arguments included
|
File::remove_extension('FulltextSearchable');
|
||||||
File::remove_extension('FulltextSearchable(\'"Filename","Title","Content"\')');
|
|
||||||
|
|
||||||
$this->assertFalse(File::has_extension('FulltextSearchable'));
|
$this->assertFalse(File::has_extension('FulltextSearchable'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user