silverstripe-framework/tests/search/FulltextSearchableTest.php
Sean Harvey acaf0e40cc 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.
2013-10-22 17:52:51 +13:00

40 lines
1.0 KiB
PHP

<?php
/**
* @package framework
* @subpackage tests
*/
class FulltextSearchableTest extends SapphireTest {
public function setUp() {
parent::setUp();
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() {
parent::tearDown();
File::remove_extension('FulltextSearchable');
Config::inst()->update('File', 'create_table_options', array('MySQLDatabase' => 'ENGINE=InnoDB'));
}
public function testEnable() {
$this->assertTrue(File::has_extension('FulltextSearchable'));
}
public function testEnableWithCustomClasses() {
FulltextSearchable::enable(array('File'));
$this->assertTrue(File::has_extension('FulltextSearchable'));
File::remove_extension('FulltextSearchable');
$this->assertFalse(File::has_extension('FulltextSearchable'));
}
}