public function tearDown()
 {
     if ($this->oldProcessor) {
         SearchUpdater::$processor = $this->oldProcessor;
     }
     Config::unnest();
     Injector::inst()->unregisterNamedObject('QueuedJobService');
     FullTextSearch::force_index_list();
     parent::tearDown();
 }
 function setUp()
 {
     parent::setUp();
     if (self::$index === null) {
         self::$index = singleton(get_class($this) . '_Index');
     } else {
         self::$index->reset();
     }
     SearchUpdater::bind_manipulation_capture();
     Config::nest();
     Config::inst()->update('Injector', 'SearchUpdateProcessor', array('class' => 'SearchUpdateImmediateProcessor'));
     FullTextSearch::force_index_list(self::$index);
     SearchUpdater::clear_dirty_indexes();
 }
 function testExcludeVariantState()
 {
     $index = singleton('SearchVariantVersionedTest_IndexNoStage');
     FullTextSearch::force_index_list($index);
     // Check that write doesn't update stage
     $item = new SearchVariantVersionedTest_Item(array('TestText' => 'Foo'));
     $item->write();
     SearchUpdater::flush_dirty_indexes();
     $this->assertEquals($index->getAdded(array('ID', '_versionedstage')), array());
     // Check that publish updates Live
     $index->reset();
     $item->publish("Stage", "Live");
     SearchUpdater::flush_dirty_indexes();
     $this->assertEquals($index->getAdded(array('ID', '_versionedstage')), array(array('ID' => $item->ID, '_versionedstage' => 'Live')));
 }
 function setUp()
 {
     parent::setUp();
     // Check subsites installed
     if (!class_exists('Subsite') || !class_exists('SubsitePolyhome')) {
         return $this->markTestSkipped('The subsites polyhome module is not installed');
     }
     if (self::$index === null) {
         self::$index = singleton('SearchVariantSiteTreeSubsitesPolyhomeTest_Index');
     }
     if (self::$subsite_a === null) {
         self::$subsite_a = new Subsite();
         self::$subsite_a->write();
         self::$subsite_b = new Subsite();
         self::$subsite_b->write();
     }
     FullTextSearch::force_index_list(self::$index);
     SearchUpdater::clear_dirty_indexes();
 }
 public function setUp()
 {
     parent::setUp();
     if (!class_exists('Phockito')) {
         $this->skipTest = true;
         return $this->markTestSkipped("These tests need the Phockito module installed to run");
     }
     // Check versioned available
     if (!class_exists('Versioned')) {
         $this->skipTest = true;
         return $this->markTestSkipped('The versioned decorator is not installed');
     }
     if (self::$index === null) {
         self::$index = singleton('SolrVersionedTest_Index');
     }
     SearchUpdater::bind_manipulation_capture();
     Config::nest();
     Config::inst()->update('Injector', 'SearchUpdateProcessor', array('class' => 'SearchUpdateImmediateProcessor'));
     FullTextSearch::force_index_list(self::$index);
     SearchUpdater::clear_dirty_indexes();
     $this->oldMode = Versioned::get_reading_mode();
     Versioned::reading_stage('Stage');
 }
 public function tearDown()
 {
     FullTextSearch::force_index_list();
     SolrReindexTest_Variant::disable();
     parent::tearDown();
 }