mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 12:05:29 +00:00
SS 4.0 - Replace inst()->update with modify()->set and hasOne with hasOneComponent
This commit is contained in:
parent
faacb6bc47
commit
43dd2ba398
@ -48,9 +48,9 @@ class BatchedProcessorTest extends SapphireTest
|
||||
|
||||
SS_Datetime::set_mock_now('2015-05-07 06:00:00');
|
||||
|
||||
Config::inst()->update('SearchUpdateBatchedProcessor', 'batch_size', 5);
|
||||
Config::inst()->update('SearchUpdateBatchedProcessor', 'batch_soft_cap', 0);
|
||||
Config::inst()->update('SearchUpdateCommitJobProcessor', 'cooldown', 600);
|
||||
Config::modify()->set('SearchUpdateBatchedProcessor', 'batch_size', 5);
|
||||
Config::modify()->set('SearchUpdateBatchedProcessor', 'batch_soft_cap', 0);
|
||||
Config::modify()->set('SearchUpdateCommitJobProcessor', 'cooldown', 600);
|
||||
|
||||
Versioned::reading_stage("Stage");
|
||||
|
||||
@ -195,20 +195,20 @@ class BatchedProcessorTest extends SapphireTest
|
||||
$processor = $this->generateDirtyIds();
|
||||
|
||||
// Test that increasing the soft cap to 2 will reduce the number of batches
|
||||
Config::inst()->update('SearchUpdateBatchedProcessor', 'batch_soft_cap', 2);
|
||||
Config::modify()->set('SearchUpdateBatchedProcessor', 'batch_soft_cap', 2);
|
||||
$processor->batchData();
|
||||
$data = $processor->getJobData();
|
||||
//Debug::dump($data);die;
|
||||
$this->assertEquals(8, $data->totalSteps);
|
||||
|
||||
// A soft cap of 1 should not fit in the hanging two items
|
||||
Config::inst()->update('SearchUpdateBatchedProcessor', 'batch_soft_cap', 1);
|
||||
Config::modify()->set('SearchUpdateBatchedProcessor', 'batch_soft_cap', 1);
|
||||
$processor->batchData();
|
||||
$data = $processor->getJobData();
|
||||
$this->assertEquals(9, $data->totalSteps);
|
||||
|
||||
// Extra large soft cap should fit both items
|
||||
Config::inst()->update('SearchUpdateBatchedProcessor', 'batch_soft_cap', 4);
|
||||
Config::modify()->set('SearchUpdateBatchedProcessor', 'batch_soft_cap', 4);
|
||||
$processor->batchData();
|
||||
$data = $processor->getJobData();
|
||||
$this->assertEquals(8, $data->totalSteps);
|
||||
|
@ -27,7 +27,7 @@ class SearchUpdaterTest extends SapphireTest
|
||||
|
||||
SearchUpdater::bind_manipulation_capture();
|
||||
|
||||
Config::inst()->update('Injector', 'SearchUpdateProcessor', array(
|
||||
Config::modify()->set('Injector', 'SearchUpdateProcessor', array(
|
||||
'class' => 'SearchUpdateImmediateProcessor'
|
||||
));
|
||||
|
||||
@ -86,6 +86,7 @@ class SearchUpdaterTest extends SapphireTest
|
||||
|
||||
SearchUpdater::flush_dirty_indexes();
|
||||
$added = self::$index->getAdded(array('ID'));
|
||||
|
||||
// Some databases don't output $added in a consistent order; that's okay
|
||||
usort($added, function ($a, $b) {return $a['ID']-$b['ID']; });
|
||||
|
||||
|
@ -31,7 +31,7 @@ class SearchVariantVersionedTest extends SapphireTest
|
||||
|
||||
SearchUpdater::bind_manipulation_capture();
|
||||
|
||||
Config::inst()->update('Injector', 'SearchUpdateProcessor', array(
|
||||
Config::modify()->set('Injector', 'SearchUpdateProcessor', array(
|
||||
'class' => 'SearchUpdateImmediateProcessor'
|
||||
));
|
||||
|
||||
|
@ -51,7 +51,7 @@ class SolrIndexSubsitesTest extends SapphireTest {
|
||||
|
||||
SearchUpdater::bind_manipulation_capture();
|
||||
|
||||
Config::inst()->update('Injector', 'SearchUpdateProcessor', array(
|
||||
Config::modify()->set('Injector', 'SearchUpdateProcessor', array(
|
||||
'class' => 'SearchUpdateImmediateProcessor'
|
||||
));
|
||||
|
||||
@ -86,7 +86,7 @@ class SolrIndexSubsitesTest extends SapphireTest {
|
||||
$variants = array();
|
||||
|
||||
// Check subsite
|
||||
if(class_exists('Subsite') && $object->hasOne('Subsite')) {
|
||||
if(class_exists('Subsite') && DataObject::getSchema()->hasOneComponent($object->getClassName(), 'Subsite')) {
|
||||
$variants[] = '"SearchVariantSubsites":"' . $subsiteID. '"';
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,7 @@ class SolrIndexTest extends SapphireTest
|
||||
public function testAddFieldExtraOptions()
|
||||
{
|
||||
Config::inst()->nest();
|
||||
Config::inst()->update('Director', 'environment_type', 'live'); // dev mode sets stored=true for everything
|
||||
Config::modify()->set('Director', 'environment_type', 'live'); // dev mode sets stored=true for everything
|
||||
|
||||
$index = new SolrIndexTest_FakeIndex();
|
||||
|
||||
|
@ -44,7 +44,7 @@ class SolrIndexVersionedTest extends SapphireTest
|
||||
|
||||
SearchUpdater::bind_manipulation_capture();
|
||||
|
||||
Config::inst()->update('Injector', 'SearchUpdateProcessor', array(
|
||||
Config::modify()->set('Injector', 'SearchUpdateProcessor', array(
|
||||
'class' => 'SearchUpdateImmediateProcessor'
|
||||
));
|
||||
|
||||
@ -77,7 +77,7 @@ class SolrIndexVersionedTest extends SapphireTest
|
||||
$class = ClassInfo::baseDataClass($object);
|
||||
// Prevent subsites from breaking tests
|
||||
$subsites = '';
|
||||
if(class_exists('Subsite') && $object->hasOne('Subsite')) {
|
||||
if(class_exists('Subsite') && DataObject::getSchema()->hasOneComponent($object->getClassName(), 'Subsite')) {
|
||||
$subsites = '"SearchVariantSubsites":"0",';
|
||||
}
|
||||
return $id.'-'.$class.'-{'.$subsites.'"SearchVariantVersioned":"'.$stage.'"}';
|
||||
|
@ -45,7 +45,7 @@ class SolrReindexQueuedTest extends SapphireTest
|
||||
}
|
||||
|
||||
// Set queued handler for reindex
|
||||
Config::inst()->update('Injector', 'SolrReindexHandler', array(
|
||||
Config::modify()->set('Injector', 'SolrReindexHandler', array(
|
||||
'class' => 'SolrReindexQueuedHandler'
|
||||
));
|
||||
Injector::inst()->registerService(new SolrReindexQueuedHandler(), 'SolrReindexHandler');
|
||||
|
@ -41,7 +41,7 @@ class SolrReindexTest extends SapphireTest
|
||||
}
|
||||
|
||||
// Set test handler for reindex
|
||||
Config::inst()->update('Injector', 'SolrReindexHandler', array(
|
||||
Config::modify()->set('Injector', 'SolrReindexHandler', array(
|
||||
'class' => 'SolrReindexTest_TestHandler'
|
||||
));
|
||||
Injector::inst()->registerService(new SolrReindexTest_TestHandler(), 'SolrReindexHandler');
|
||||
|
@ -17,7 +17,7 @@ class SolrReindexTest_ItemExtension extends DataExtension implements TestOnly
|
||||
/**
|
||||
* Filter records on the current variant
|
||||
*
|
||||
* @param SQLQuery $query
|
||||
* @param SQLSelect $query
|
||||
* @param DataQuery $dataQuery
|
||||
*/
|
||||
public function augmentSQL(SQLSelect $query, DataQuery $dataQuery = NULL)
|
||||
|
Loading…
x
Reference in New Issue
Block a user