From f7236905c5e1034beb9cbc291997afd3b32129cd Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Fri, 7 Sep 2012 11:55:41 -0400
Subject: [PATCH] Search results objects' getRecord() / getRecords() methods
 are no longer static (to allow service locator integration).

---
 .../src/VuFind/Controller/AbstractRecord.php  | 19 +++-----
 .../VuFind/Controller/AuthorityController.php |  4 +-
 .../Controller/MyResearchController.php       |  9 ++--
 .../src/VuFind/Controller/VudlController.php  |  3 +-
 module/VuFind/src/VuFind/ILS/Driver/NoILS.php | 45 +++++++++++++++++--
 .../VuFind/src/VuFind/ILS/Driver/Symphony.php | 34 ++++++++++++--
 module/VuFind/src/VuFind/OAI/Server.php       |  4 +-
 module/VuFind/src/VuFind/Record/Loader.php    | 19 ++++----
 .../VuFind/src/VuFind/Search/Base/Results.php | 10 ++---
 .../src/VuFind/Search/EmptySet/Results.php    |  4 +-
 .../src/VuFind/Search/Favorites/Results.php   |  4 +-
 .../src/VuFind/Search/MixedList/Results.php   |  4 +-
 .../VuFind/src/VuFind/Search/Solr/Results.php | 14 +++---
 .../src/VuFind/Search/Summon/Results.php      |  4 +-
 .../VuFind/src/VuFind/Search/Tags/Results.php |  4 +-
 .../src/VuFind/Search/WorldCat/Results.php    |  4 +-
 .../tests/RecordDriver/SolrMarcTest.php       |  3 +-
 17 files changed, 122 insertions(+), 66 deletions(-)

diff --git a/module/VuFind/src/VuFind/Controller/AbstractRecord.php b/module/VuFind/src/VuFind/Controller/AbstractRecord.php
index f1c2d39f240..d5aacef3e24 100644
--- a/module/VuFind/src/VuFind/Controller/AbstractRecord.php
+++ b/module/VuFind/src/VuFind/Controller/AbstractRecord.php
@@ -46,20 +46,10 @@ class AbstractRecord extends AbstractBase
     protected $defaultTab = 'Holdings';
     protected $account;
     protected $searchClassId = 'Solr';
-    protected $searchObject;
     protected $useResultScroller = true;
     protected $logStatistics = true;
     protected $driver = null;
 
-    /**
-     * Constructor
-     */
-    public function __construct()
-    {
-        // Set up search class ID-related settings:
-        $this->searchObject = 'VuFind\Search\\' . $this->searchClassId . '\Results';
-    }
-
     /**
      * Create a new ViewModel.
      *
@@ -217,7 +207,7 @@ class AbstractRecord extends AbstractBase
         $driver->saveToFavorites($this->getRequest()->getPost()->toArray(), $user);
 
         // Grab the followup namespace so we know where to send the user next:
-        $followup = new SessionContainer($this->searchObject . 'SaveFollowup');
+        $followup = new SessionContainer($this->searchClassId . 'SaveFollowup');
         $url = isset($followup->url) ? (string)$followup->url : false;
         if (!empty($url)) {
             // Display a success status message:
@@ -257,7 +247,7 @@ class AbstractRecord extends AbstractBase
         // ProcessSave action (to get back to where we came from after saving).
         // We only save if we don't already have a saved URL; otherwise we
         // might accidentally redirect to the "create new list" screen!
-        $followup = new SessionContainer($this->searchObject . 'SaveFollowup');
+        $followup = new SessionContainer($this->searchClassId . 'SaveFollowup');
         $followup->url = (isset($followup->url) && !empty($followup->url))
             ? $followup->url : $this->getRequest()->getServer()->get('HTTP_REFERER');
 
@@ -460,8 +450,9 @@ class AbstractRecord extends AbstractBase
         // common scenario) and the GET parameters (a fallback used by some
         // legacy routes).
         if (!is_object($this->driver)) {
-            $this->driver = call_user_func(
-                array($this->searchObject, 'getRecord'),
+            $sm = $this->getServiceLocator()->get('SearchManager');
+            $results = $sm->setSearchClassId($this->searchClassId)->getResults();
+            $this->driver = $results->getRecord(
                 $this->params()->fromRoute('id', $this->params()->fromQuery('id'))
             );
         }
diff --git a/module/VuFind/src/VuFind/Controller/AuthorityController.php b/module/VuFind/src/VuFind/Controller/AuthorityController.php
index 8122d612733..c81e4fef2b4 100644
--- a/module/VuFind/src/VuFind/Controller/AuthorityController.php
+++ b/module/VuFind/src/VuFind/Controller/AuthorityController.php
@@ -26,7 +26,6 @@
  * @link     http://vufind.org   Main Site
  */
 namespace VuFind\Controller;
-use VuFind\Search\SolrAuth\Results;
 
 /**
  * Authority Controller
@@ -69,7 +68,8 @@ class AuthorityController extends AbstractSearch
     {
         return $this->createViewModel(
             array(
-                'driver' => Results::getRecord($this->params()->fromQuery('id'))
+                'driver' => $this->getSearchManager()->setSearchClassId('SolrAuth')
+                    ->getResults()->getRecord($this->params()->fromQuery('id'))
             )
         );
     }
diff --git a/module/VuFind/src/VuFind/Controller/MyResearchController.php b/module/VuFind/src/VuFind/Controller/MyResearchController.php
index 004e39ed3b8..ff7779acd4e 100644
--- a/module/VuFind/src/VuFind/Controller/MyResearchController.php
+++ b/module/VuFind/src/VuFind/Controller/MyResearchController.php
@@ -34,8 +34,7 @@ use VuFind\Config\Reader as ConfigReader,
     VuFind\Exception\Auth as AuthException,
     VuFind\Exception\ListPermission as ListPermissionException,
     VuFind\Exception\RecordMissing as RecordMissingException,
-    VuFind\Record\Loader as RecordLoader,
-    VuFind\Record\Router as RecordRouter, VuFind\Search\Solr\Results as SolrResults,
+    VuFind\Record\Loader as RecordLoader, VuFind\Record\Router as RecordRouter,
     Zend\Stdlib\Parameters;
 
 /**
@@ -730,7 +729,8 @@ class MyResearchController extends AbstractBase
             if (!isset($current['id'])) {
                 throw new RecordMissingException();
             }
-            $record = SolrResults::getRecord($current['id']);
+            $record = $this->getSearchManager()->setSearchClassId('Solr')
+                ->getResults()->getRecord($current['id']);
         } catch (RecordMissingException $e) {
             $record = new \VuFind\RecordDriver\Missing();
             $record->setRawData(
@@ -868,7 +868,8 @@ class MyResearchController extends AbstractBase
                 if (!isset($row['id']) || empty($row['id'])) {
                     throw new \Exception();
                 }
-                $record = SolrResults::getRecord($row['id']);
+                $record = $this->getSearchManager()->setSearchClassId('Solr')
+                    ->getResults()->getRecord($row['id']);
                 $row['title'] = $record->getShortTitle();
             } catch (\Exception $e) {
                 if (!isset($row['title'])) {
diff --git a/module/VuFind/src/VuFind/Controller/VudlController.php b/module/VuFind/src/VuFind/Controller/VudlController.php
index 40e35193325..744996e5664 100644
--- a/module/VuFind/src/VuFind/Controller/VudlController.php
+++ b/module/VuFind/src/VuFind/Controller/VudlController.php
@@ -57,7 +57,8 @@ class VudlController extends AbstractBase
         $view->id = $id;
 
         // GET XML FILE NAME
-        $driver = SolrResults::getRecord($id);
+        $driver = $this->getSearchManager()->setSearchClassId('Solr')
+            ->getResults()->getRecord($id);
         if (!method_exists($driver, 'getFullRecord')) {
             throw new \Exception('Cannot obtain VuDL record');
         }
diff --git a/module/VuFind/src/VuFind/ILS/Driver/NoILS.php b/module/VuFind/src/VuFind/ILS/Driver/NoILS.php
index 0df0eaabe50..b9bd25b6791 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/NoILS.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/NoILS.php
@@ -28,7 +28,8 @@
  */
 namespace VuFind\ILS\Driver;
 use VuFind\Config\Reader as ConfigReader, VuFind\Exception\ILS as ILSException,
-    VuFind\Search\Solr\Results as SolrResults, VuFind\Translator\Translator;
+    VuFind\Translator\Translator, Zend\ServiceManager\ServiceLocatorAwareInterface,
+    Zend\ServiceManager\ServiceLocatorInterface;
 
 /**
  * Driver for offline/missing ILS.
@@ -40,7 +41,7 @@ use VuFind\Config\Reader as ConfigReader, VuFind\Exception\ILS as ILSException,
  * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
  * @link     http://vufind.org/wiki/building_an_ils_driver Wiki
  */
-class NoILS extends AbstractBase
+class NoILS extends AbstractBase implements ServiceLocatorAwareInterface
 {
     /**
      * Initialize the driver.
@@ -69,6 +70,19 @@ class NoILS extends AbstractBase
         return isset($this->config[$function]) ? $this->config[$function] : false;
     }
 
+    /**
+     * Get a Solr record.
+     *
+     * @param string $id ID of record to retrieve
+     *
+     * @return \VuFind\RecordDriver\AbstractBase
+     */
+    public function getSolrRecord($id)
+    {
+        return $this->getServiceLocator()->getServiceLocator()->get('SearchManager')
+            ->setSearchClassId('Solr')->getResults()->getRecord($id);
+    }
+
     /**
      * Get Status
      *
@@ -106,7 +120,7 @@ class NoILS extends AbstractBase
             );
         } else if ($useStatus == "marc") {
             // Retrieve record from index:
-            $recordDriver = SolrResults::getRecord($id);
+            $recordDriver = $this->getSolrRecord($id);
             return $this->getFormattedMarcDetails($recordDriver, 'MarcStatus');
         }
         return array();
@@ -185,7 +199,7 @@ class NoILS extends AbstractBase
             );
         } elseif ($useHoldings == "marc") {
             // Retrieve record from index:
-            $recordDriver = SolrResults::getRecord($id);
+            $recordDriver = $this->getSolrRecord($id);
             return $this->getFormattedMarcDetails($recordDriver, 'MarcHoldings');
         }
 
@@ -316,4 +330,27 @@ class NoILS extends AbstractBase
         // Block authentication:
         return null;
     }
+
+    /**
+     * Set the service locator.
+     *
+     * @param ServiceLocatorInterface $serviceLocator Locator to register
+     *
+     * @return NoILS
+     */
+    public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
+    {
+        $this->serviceLocator = $serviceLocator;
+        return $this;
+    }
+
+    /**
+     * Get the service locator.
+     *
+     * @return \Zend\ServiceManager\ServiceLocatorInterface
+     */
+    public function getServiceLocator()
+    {
+        return $this->serviceLocator;
+    }
 }
diff --git a/module/VuFind/src/VuFind/ILS/Driver/Symphony.php b/module/VuFind/src/VuFind/ILS/Driver/Symphony.php
index 50c1af041ea..86473511789 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/Symphony.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/Symphony.php
@@ -28,7 +28,9 @@
  */
 namespace VuFind\ILS\Driver;
 use SoapClient, SoapFault, VuFind\Cache\Manager as CacheManager,
-    VuFind\Config\Reader as ConfigReader, VuFind\Exception\ILS as ILSException;
+    VuFind\Config\Reader as ConfigReader, VuFind\Exception\ILS as ILSException,
+    Zend\ServiceManager\ServiceLocatorAwareInterface,
+    Zend\ServiceManager\ServiceLocatorInterface;
 
 /**
  * Symphony Web Services (symws) ILS Driver
@@ -41,7 +43,7 @@ use SoapClient, SoapFault, VuFind\Cache\Manager as CacheManager,
  * @link     http://vufind.org/wiki/building_an_ils_driver Wiki
  */
 
-class Symphony extends AbstractBase
+class Symphony extends AbstractBase implements ServiceLocatorAwareInterface
 {
     protected $policyCache = false;
     protected $policies;
@@ -301,7 +303,10 @@ class Symphony extends AbstractBase
 
         $entryNumber = $this->config['999Holdings']['entry_number'];
 
-        foreach (\VuFind\Search\Solr\Results::getRecords($ids) as $record) {
+        $records = $this->getServiceLocator()->getServiceLocator()
+            ->get('SearchManager')->setSearchClassId('Solr')->getResults()
+            ->getRecords($ids);
+        foreach ($records as $record) {
             $results = $record->getFormattedMarcDetails($entryNumber, $marcMap);
             foreach ($results as $result) {
                 $library  = $this->translatePolicyID('LIBR', $result['library']);
@@ -1480,4 +1485,27 @@ class Symphony extends AbstractBase
             return $libraries[0]['locationID'];
         }
     }
+
+    /**
+     * Set the service locator.
+     *
+     * @param ServiceLocatorInterface $serviceLocator Locator to register
+     *
+     * @return Symphony
+     */
+    public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
+    {
+        $this->serviceLocator = $serviceLocator;
+        return $this;
+    }
+
+    /**
+     * Get the service locator.
+     *
+     * @return \Zend\ServiceManager\ServiceLocatorInterface
+     */
+    public function getServiceLocator()
+    {
+        return $this->serviceLocator;
+    }
 }
diff --git a/module/VuFind/src/VuFind/OAI/Server.php b/module/VuFind/src/VuFind/OAI/Server.php
index 1845be2367b..970086c0c0f 100644
--- a/module/VuFind/src/VuFind/OAI/Server.php
+++ b/module/VuFind/src/VuFind/OAI/Server.php
@@ -687,9 +687,9 @@ class Server
         // Strip the ID prefix, if necessary:
         $id = $this->stripID($id);
         if ($id !== false) {
-            $resultsClass = 'VuFind\Search\\' . $this->searchClassId . '\Results';
             try {
-                return $resultsClass::getRecord($id);
+                return $this->searchManager->setSearchClassId($this->searchClassId)
+                    ->getResults()->getRecord($id);
             } catch (RecordMissingException $e) {
                 return false;
             }
diff --git a/module/VuFind/src/VuFind/Record/Loader.php b/module/VuFind/src/VuFind/Record/Loader.php
index a281fda23e5..2f31d6072b7 100644
--- a/module/VuFind/src/VuFind/Record/Loader.php
+++ b/module/VuFind/src/VuFind/Record/Loader.php
@@ -56,25 +56,24 @@ class Loader implements ServiceLocatorAwareInterface
     }
 
     /**
-     * Given a record source, return the search class that can load that type of
+     * Given a record source, return the search object that can load that type of
      * record.
      *
      * @param string $source Record source
      *
      * @throws \Exception
-     * @return string
+     * @return \VuFind\Search\Base\Results
      */
     protected function getClassForSource($source)
     {
         $sm = $this->getServiceLocator()->get('SearchManager');
-        $class = $sm->setSearchClassId($source)->getResultsClass();
 
         // Throw an error if we can't find a loader class:
-        if (!class_exists($class)) {
+        try {
+            return $sm->setSearchClassId($source)->getResults();
+        } catch (\Exception $e) {
             throw new \Exception('Unrecognized data source: ' . $source);
         }
-
-        return $class;
     }
 
     /**
@@ -89,8 +88,7 @@ class Loader implements ServiceLocatorAwareInterface
     public function load($id, $source = 'VuFind')
     {
         // Load the record:
-        $class = $this->getClassForSource($source);
-        return call_user_func(array($class, 'getRecord'), $id);
+        return $this->getClassForSource($source)->getRecord($id);
     }
 
     /**
@@ -127,9 +125,8 @@ class Loader implements ServiceLocatorAwareInterface
         // Retrieve the records and put them back in order:
         $retVal = array();
         foreach ($idBySource as $source => $details) {
-            $class = $this->getClassForSource($source);
-            $records
-                = call_user_func(array($class, 'getRecords'), array_keys($details));
+            $records = $this->getClassForSource($source)
+                ->getRecords(array_keys($details));
             foreach ($records as $current) {
                 $id = $current->getUniqueId();
                 $retVal[$details[$id]] = $current;
diff --git a/module/VuFind/src/VuFind/Search/Base/Results.php b/module/VuFind/src/VuFind/Search/Base/Results.php
index 2c57073ee56..7c1427a23cd 100644
--- a/module/VuFind/src/VuFind/Search/Base/Results.php
+++ b/module/VuFind/src/VuFind/Search/Base/Results.php
@@ -184,26 +184,26 @@ abstract class Results implements ServiceLocatorAwareInterface
     abstract protected function performSearch();
 
     /**
-     * Static method to retrieve a record by ID.  Returns a record driver object.
+     * Method to retrieve a record by ID.  Returns a record driver object.
      *
      * @param string $id Unique identifier of record
      *
      * @return \VuFind\RecordDriver\AbstractBase
      */
-    public static function getRecord($id)
+    public function getRecord($id)
     {
         // This needs to be defined in subclasses:
         throw new \Exception('getRecord needs to be defined.');
     }
 
     /**
-     * Static method to retrieve an array of records by ID.
+     * Method to retrieve an array of records by ID.
      *
      * @param array $ids Array of unique record identifiers.
      *
      * @return array
      */
-    public static function getRecords($ids)
+    public function getRecords($ids)
     {
         // This is the default, dumb behavior for retrieving multiple records --
         // just call getRecord() repeatedly.  For efficiency, this method should
@@ -211,7 +211,7 @@ abstract class Results implements ServiceLocatorAwareInterface
         $retVal = array();
         foreach ($ids as $id) {
             try {
-                $retVal[] = static::getRecord($id);
+                $retVal[] = $this->getRecord($id);
             } catch (\Exception $e) {
                 // Just omit missing records from the return array; calling code in
                 // \VuFind\Record\Loader::loadBatch() will deal with this.
diff --git a/module/VuFind/src/VuFind/Search/EmptySet/Results.php b/module/VuFind/src/VuFind/Search/EmptySet/Results.php
index bdd0290f739..ac39d259255 100644
--- a/module/VuFind/src/VuFind/Search/EmptySet/Results.php
+++ b/module/VuFind/src/VuFind/Search/EmptySet/Results.php
@@ -65,14 +65,14 @@ class Results extends BaseResults
     }
 
     /**
-     * Static method to retrieve a record by ID.  Returns a record driver object.
+     * Method to retrieve a record by ID.  Returns a record driver object.
      *
      * @param string $id Unique identifier of record
      *
      * @throws \Exception
      * @return \VuFind\RecordDriver\AbstractBase
      */
-    public static function getRecord($id)
+    public function getRecord($id)
     {
         throw new \Exception('Cannot get record from empty set.');
     }
diff --git a/module/VuFind/src/VuFind/Search/Favorites/Results.php b/module/VuFind/src/VuFind/Search/Favorites/Results.php
index 2d6271eb950..d9f248bca8f 100644
--- a/module/VuFind/src/VuFind/Search/Favorites/Results.php
+++ b/module/VuFind/src/VuFind/Search/Favorites/Results.php
@@ -176,13 +176,13 @@ class Results extends BaseResults
     }
 
     /**
-     * Static method to retrieve a record by ID.  Returns a record driver object.
+     * Method to retrieve a record by ID.  Returns a record driver object.
      *
      * @param string $id Unique identifier of record
      *
      * @return \VuFind\RecordDriver\Base
      */
-    public static function getRecord($id)
+    public function getRecord($id)
     {
         throw new \Exception(
             'getRecord not supported by VuFind\Search\Favorites\Results'
diff --git a/module/VuFind/src/VuFind/Search/MixedList/Results.php b/module/VuFind/src/VuFind/Search/MixedList/Results.php
index 2cc6001a249..0bfbafc168d 100644
--- a/module/VuFind/src/VuFind/Search/MixedList/Results.php
+++ b/module/VuFind/src/VuFind/Search/MixedList/Results.php
@@ -67,13 +67,13 @@ class Results extends BaseResults
     }
 
     /**
-     * Static method to retrieve a record by ID.  Returns a record driver object.
+     * Method to retrieve a record by ID.  Returns a record driver object.
      *
      * @param string $id Unique identifier of record
      *
      * @return \VuFind\RecordDriver\Base
      */
-    public static function getRecord($id)
+    public function getRecord($id)
     {
         throw new \Exception(
             'getRecord not supported by VuFind\Search\MixedList\Results'
diff --git a/module/VuFind/src/VuFind/Search/Solr/Results.php b/module/VuFind/src/VuFind/Search/Solr/Results.php
index 189bb36f39a..3ccb0434996 100644
--- a/module/VuFind/src/VuFind/Search/Solr/Results.php
+++ b/module/VuFind/src/VuFind/Search/Solr/Results.php
@@ -59,9 +59,9 @@ class Results extends BaseResults
      */
     public static function getSolrConnection($shards = null, $index = 'Solr')
     {
-        // Turn on all shards by default if none are specified (since we may get
-        // called in a static context by getRecord(), we need to be sure that any
-        // given ID will yield results, even if not all shards are on by default).
+        // Turn on all shards by default if none are specified (we need to be sure
+        // that any given ID will yield results, even if not all shards are on by
+        // default).
         $options = SearchOptions::getInstance($index);
         $allShards = $options->getShards();
         if (is_null($shards)) {
@@ -446,14 +446,14 @@ class Results extends BaseResults
     }
 
     /**
-     * Static method to retrieve a record by ID.  Returns a record driver object.
+     * Method to retrieve a record by ID.  Returns a record driver object.
      *
      * @param string $id Unique identifier of record
      *
      * @throws RecordMissingException
      * @return \VuFind\RecordDriver\Base
      */
-    public static function getRecord($id)
+    public function getRecord($id)
     {
         $solr = static::getSolrConnection();
 
@@ -474,13 +474,13 @@ class Results extends BaseResults
     }
 
     /**
-     * Static method to retrieve an array of records by ID.
+     * Method to retrieve an array of records by ID.
      *
      * @param array $ids Array of unique record identifiers.
      *
      * @return array
      */
-    public static function getRecords($ids)
+    public function getRecords($ids)
     {
         // Figure out how many records to retrieve at the same time --
         // we'll use either 100 or the ID request limit, whichever is smaller.
diff --git a/module/VuFind/src/VuFind/Search/Summon/Results.php b/module/VuFind/src/VuFind/Search/Summon/Results.php
index 81eb07ed322..475de19a996 100644
--- a/module/VuFind/src/VuFind/Search/Summon/Results.php
+++ b/module/VuFind/src/VuFind/Search/Summon/Results.php
@@ -129,14 +129,14 @@ class Results extends BaseResults
     }
 
     /**
-     * Static method to retrieve a record by ID.  Returns a record driver object.
+     * Method to retrieve a record by ID.  Returns a record driver object.
      *
      * @param string $id Unique identifier of record
      *
      * @throws RecordMissingException
      * @return \VuFind\RecordDriver\Base
      */
-    public static function getRecord($id)
+    public function getRecord($id)
     {
         $summon = static::getSummonConnection();
         $record = $summon->getRecord($id);
diff --git a/module/VuFind/src/VuFind/Search/Tags/Results.php b/module/VuFind/src/VuFind/Search/Tags/Results.php
index 09873c0146f..a0ce43fbd84 100644
--- a/module/VuFind/src/VuFind/Search/Tags/Results.php
+++ b/module/VuFind/src/VuFind/Search/Tags/Results.php
@@ -78,13 +78,13 @@ class Results extends BaseResults
     }
 
     /**
-     * Static method to retrieve a record by ID.  Returns a record driver object.
+     * Method to retrieve a record by ID.  Returns a record driver object.
      *
      * @param string $id Unique identifier of record
      *
      * @return \VuFind\RecordDriver\Base
      */
-    public static function getRecord($id)
+    public function getRecord($id)
     {
         throw new \Exception(
             'getRecord not supported by VuFind\Search\Tags\Results'
diff --git a/module/VuFind/src/VuFind/Search/WorldCat/Results.php b/module/VuFind/src/VuFind/Search/WorldCat/Results.php
index eb5e232d605..3bc637c3efc 100644
--- a/module/VuFind/src/VuFind/Search/WorldCat/Results.php
+++ b/module/VuFind/src/VuFind/Search/WorldCat/Results.php
@@ -98,14 +98,14 @@ class Results extends BaseResults
     }
 
     /**
-     * Static method to retrieve a record by ID.  Returns a record driver object.
+     * Method to retrieve a record by ID.  Returns a record driver object.
      *
      * @param string $id Unique identifier of record
      *
      * @throws RecordMissingException
      * @return \VuFind\RecordDriver\Base
      */
-    public static function getRecord($id)
+    public function getRecord($id)
     {
         $wc = static::getWorldCatConnection();
         $record = $wc->getRecord($id);
diff --git a/module/VuFind/tests/RecordDriver/SolrMarcTest.php b/module/VuFind/tests/RecordDriver/SolrMarcTest.php
index a2f6a488058..ab165e06be3 100644
--- a/module/VuFind/tests/RecordDriver/SolrMarcTest.php
+++ b/module/VuFind/tests/RecordDriver/SolrMarcTest.php
@@ -48,7 +48,8 @@ class SolrMarcTest extends \VuFind\Tests\TestCase
      */
     public function testBug2()
     {
-        $record = \VuFind\Search\Solr\Results::getRecord('testbug2');
+        $record = $this->getSearchManager()->setSearchClassId('Solr')
+            ->getResults()->getRecord('testbug2');
         $this->assertEquals(
             $record->getPrimaryAuthor(),
             'Vico, Giambattista, 1668-1744.'
-- 
GitLab