mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
acaf0e40cc
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.
40 lines
1.0 KiB
PHP
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'));
|
|
}
|
|
|
|
}
|