Blame view

framework/tests/search/FulltextSearchableTest.php 1.01 KB
70f4f18b   Administrator   first_commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
  <?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'));
  	}
  
  }