FIX Remove resetDBSchema use, not required and breaking 4.2 tests

Also reduces tearDown to protected visiblity as it is in SapphireTest and optimises class imports
This commit is contained in:
Robbie Averill 2018-06-15 14:07:30 +12:00
parent 0afe8c92d7
commit 2fdf87bbf1

View File

@ -2,22 +2,20 @@
namespace SilverStripe\FullTextSearch\Tests; namespace SilverStripe\FullTextSearch\Tests;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\FullTextSearch\Search\FullTextSearch;
use SilverStripe\FullTextSearch\Search\Updaters\SearchUpdater;
use SilverStripe\FullTextSearch\Search\Variants\SearchVariant;
use SilverStripe\FullTextSearch\Tests\SolrReindexTest\SolrReindexTest_Variant;
use SilverStripe\FullTextSearch\Tests\SolrReindexTest\SolrReindexTest_Index;
use SilverStripe\FullTextSearch\Tests\SolrReindexTest\SolrReindexTest_TestHandler;
use SilverStripe\FullTextSearch\Tests\SolrReindexTest\SolrReindexTest_Item;
use SilverStripe\FullTextSearch\Tests\SolrReindexTest\SolrReindexTest_RecordingLogger;
use SilverStripe\FullTextSearch\Solr\Reindex\Handlers\SolrReindexHandler;
use SilverStripe\FullTextSearch\Solr\Services\Solr4Service;
use SilverStripe\FullTextSearch\Solr\Tasks\Solr_Reindex;
use SilverStripe\Core\Config\Config; use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Injector\Injector;
use SilverStripe\ORM\DataObject; use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\DB; use SilverStripe\FullTextSearch\Search\FullTextSearch;
use SilverStripe\FullTextSearch\Search\Variants\SearchVariant;
use SilverStripe\FullTextSearch\Solr\Reindex\Handlers\SolrReindexHandler;
use SilverStripe\FullTextSearch\Solr\Services\Solr4Service;
use SilverStripe\FullTextSearch\Solr\Services\SolrService;
use SilverStripe\FullTextSearch\Solr\Tasks\Solr_Reindex;
use SilverStripe\FullTextSearch\Tests\SolrReindexTest\SolrReindexTest_Index;
use SilverStripe\FullTextSearch\Tests\SolrReindexTest\SolrReindexTest_Item;
use SilverStripe\FullTextSearch\Tests\SolrReindexTest\SolrReindexTest_RecordingLogger;
use SilverStripe\FullTextSearch\Tests\SolrReindexTest\SolrReindexTest_TestHandler;
use SilverStripe\FullTextSearch\Tests\SolrReindexTest\SolrReindexTest_Variant;
class SolrReindexTest extends SapphireTest class SolrReindexTest extends SapphireTest
{ {
@ -70,11 +68,9 @@ class SolrReindexTest extends SapphireTest
*/ */
protected function createDummyData($number) protected function createDummyData($number)
{ {
self::resetDBSchema();
// Note that we don't create any records in variant = 2, to represent a variant // Note that we don't create any records in variant = 2, to represent a variant
// that should be cleared without any re-indexes performed // that should be cleared without any re-indexes performed
foreach (array(0, 1) as $variant) { foreach ([0, 1] as $variant) {
for ($i = 1; $i <= $number; $i++) { for ($i = 1; $i <= $number; $i++) {
$item = new SolrReindexTest_Item(); $item = new SolrReindexTest_Item();
$item->Variant = $variant; $item->Variant = $variant;
@ -97,7 +93,7 @@ class SolrReindexTest extends SapphireTest
return $serviceMock->getMock(); return $serviceMock->getMock();
} }
public function tearDown() protected function tearDown()
{ {
FullTextSearch::force_index_list(); FullTextSearch::force_index_list();
SolrReindexTest_Variant::disable(); SolrReindexTest_Variant::disable();