From f1d3a8df27164221c0d8be7213843875dd128938 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Tue, 17 Dec 2019 15:26:38 -0500 Subject: [PATCH] Eliminate hard-coded class strings. --- .../VuFind/src/VuFindTest/Unit/TestCase.php | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/module/VuFind/src/VuFindTest/Unit/TestCase.php b/module/VuFind/src/VuFindTest/Unit/TestCase.php index 3dd9ff53eef..eed2055534b 100644 --- a/module/VuFind/src/VuFindTest/Unit/TestCase.php +++ b/module/VuFind/src/VuFindTest/Unit/TestCase.php @@ -145,56 +145,57 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase $this->serviceManager, [ 'abstract_factories' => - ['VuFind\Search\Options\PluginFactory'], + [\VuFind\Search\Options\PluginFactory::class], ] ); $this->serviceManager->setService( - 'VuFind\Search\Options\PluginManager', $optionsFactory + \VuFind\Search\Options\PluginManager::class, $optionsFactory ); $paramsFactory = new \VuFind\Search\Params\PluginManager( $this->serviceManager, [ 'abstract_factories' => - ['VuFind\Search\Params\PluginFactory'], + [\VuFind\Search\Params\PluginFactory::class], ] ); $this->serviceManager->setService( - 'VuFind\Search\Params\PluginManager', $paramsFactory + \VuFind\Search\Params\PluginManager::class, $paramsFactory ); $resultsFactory = new \VuFind\Search\Results\PluginManager( $this->serviceManager, [ 'abstract_factories' => - ['VuFind\Search\Results\PluginFactory'], + [\VuFind\Search\Results\PluginFactory::class], ] ); $this->serviceManager->setService( - 'VuFind\Search\Results\PluginManager', $resultsFactory + \VuFind\Search\Results\PluginManager::class, $resultsFactory ); $recordDriverFactory = new \VuFind\RecordDriver\PluginManager( $this->serviceManager, [ 'abstract_factories' => - ['VuFind\RecordDriver\PluginFactory'] + [\VuFind\RecordDriver\PluginFactory::class] ] ); $this->serviceManager->setService( - 'VuFind\RecordDriver\PluginManager', $recordDriverFactory + \VuFind\RecordDriver\PluginManager::class, $recordDriverFactory ); $this->serviceManager->setService( - 'VuFind\Config\SearchSpecsReader', + \VuFind\Config\SearchSpecsReader::class, new \VuFind\Config\SearchSpecsReader() ); $this->serviceManager->setService( - 'VuFind\Log\Logger', $this->createMock(\VuFind\Log\Logger::class) + \VuFind\Log\Logger::class, + $this->createMock(\VuFind\Log\Logger::class) ); $this->serviceManager->setService( - 'VuFindHttp\HttpService', new \VuFindHttp\HttpService() + \VuFindHttp\HttpService::class, new \VuFindHttp\HttpService() ); $this->setupSearchService(); - $cfg = ['abstract_factories' => ['VuFind\Config\PluginFactory']]; + $cfg = ['abstract_factories' => [\VuFind\Config\PluginFactory::class]]; $this->serviceManager->setService( - 'VuFind\Config\PluginManager', + \VuFind\Config\PluginManager::class, new \VuFind\Config\PluginManager($this->serviceManager, $cfg) ); $this->serviceManager->setService( @@ -203,7 +204,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase $driverManager = $this->serviceManager ->get(\VuFind\RecordDriver\PluginManager::class); $this->serviceManager->setService( - 'VuFind\Record\Loader', new \VuFind\Record\Loader( + \VuFind\Record\Loader::class, new \VuFind\Record\Loader( $this->serviceManager->get(\VuFindSearch\Service::class), $driverManager ) @@ -211,7 +212,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase $this->serviceManager->setService('Config', []); $factory = new \Zend\Mvc\I18n\TranslatorFactory(); $this->serviceManager->setService( - 'Zend\Mvc\I18n\Translator', + \Zend\Mvc\I18n\Translator::class, $factory->createService($this->serviceManager) ); } -- GitLab