From b9e2fd46eaea0da378c63512126a10a46f271674 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Wed, 1 Nov 2017 16:41:31 -0400
Subject: [PATCH] Update tests for future compatibility with ServiceManager v3.

---
 .../tests/unit-tests/src/VuFindTest/Auth/ChoiceAuthTest.php    | 2 +-
 .../tests/unit-tests/src/VuFindTest/Auth/DatabaseUnitTest.php  | 2 +-
 .../tests/unit-tests/src/VuFindTest/Auth/ManagerTest.php       | 2 +-
 .../tests/unit-tests/src/VuFindTest/Autocomplete/TagTest.php   | 2 +-
 .../unit-tests/src/VuFindTest/ILS/Driver/MultiBackendTest.php  | 3 ++-
 .../unit-tests/src/VuFindTest/Role/DynamicRoleProviderTest.php | 2 +-
 6 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Auth/ChoiceAuthTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Auth/ChoiceAuthTest.php
index 7af78f87e61..1f87186be87 100644
--- a/module/VuFind/tests/unit-tests/src/VuFindTest/Auth/ChoiceAuthTest.php
+++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Auth/ChoiceAuthTest.php
@@ -247,7 +247,7 @@ class ChoiceAuthTest extends \VuFindTest\Unit\TestCase
      */
     protected function getMockPluginManager()
     {
-        $pm = new PluginManager();
+        $pm = new PluginManager($this->getServiceManager());
         $mockDb = $this->getMockBuilder('VuFind\Auth\Database')
             ->disableOriginalConstructor()
             ->getMock();
diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Auth/DatabaseUnitTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Auth/DatabaseUnitTest.php
index 75c0a0a9c4d..3358d220089 100644
--- a/module/VuFind/tests/unit-tests/src/VuFindTest/Auth/DatabaseUnitTest.php
+++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Auth/DatabaseUnitTest.php
@@ -252,7 +252,7 @@ class DatabaseUnitTest extends \VuFindTest\Unit\DbTestCase
     protected function getDatabase($table)
     {
         $tableManager = $this->getMockBuilder('VuFind\Db\Table\PluginManager')
-            ->setMethods(['get'])->getMock();
+            ->disableOriginalConstructor()->setMethods(['get'])->getMock();
         $tableManager->expects($this->once())->method('get')
             ->with($this->equalTo('User'))
             ->will($this->returnValue($table));
diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Auth/ManagerTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Auth/ManagerTest.php
index d316785237c..7f571b427b2 100644
--- a/module/VuFind/tests/unit-tests/src/VuFindTest/Auth/ManagerTest.php
+++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Auth/ManagerTest.php
@@ -548,7 +548,7 @@ class ManagerTest extends \VuFindTest\Unit\TestCase
      */
     protected function getMockPluginManager()
     {
-        $pm = new PluginManager();
+        $pm = new PluginManager($this->getServiceManager());
         $mockChoice = $this->getMockBuilder('VuFind\Auth\ChoiceAuth')
             ->disableOriginalConstructor()
             ->getMock();
diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Autocomplete/TagTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Autocomplete/TagTest.php
index 11673bdde76..d0f83df7c6c 100644
--- a/module/VuFind/tests/unit-tests/src/VuFindTest/Autocomplete/TagTest.php
+++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Autocomplete/TagTest.php
@@ -74,7 +74,7 @@ class TagTest extends \VuFindTest\Unit\DbTestCase
             ->with($this->equalTo('foo'))
             ->will($this->returnValue($tags));
         $tableManager = $this->getMockBuilder('VuFind\Db\Table\PluginManager')
-            ->setMethods(['get'])->getMock();
+            ->disableOriginalConstructor()->setMethods(['get'])->getMock();
         $tableManager->expects($this->once())->method('get')
             ->with($this->equalTo('Tags'))
             ->will($this->returnValue($tagTable));
diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/MultiBackendTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/MultiBackendTest.php
index 7ee95ea7790..87e5410fa08 100644
--- a/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/MultiBackendTest.php
+++ b/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/MultiBackendTest.php
@@ -53,7 +53,8 @@ class MultiBackendTest extends \VuFindTest\Unit\TestCase
     {
         $this->setExpectedException('VuFind\Exception\ILS');
         $test = new MultiBackend(
-            new \VuFind\Config\PluginManager(), $this->getMockILSAuthenticator(),
+            new \VuFind\Config\PluginManager($this->getServiceManager()),
+            $this->getMockILSAuthenticator(),
             $this->getMockSM()
         );
         $test->init();
diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Role/DynamicRoleProviderTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Role/DynamicRoleProviderTest.php
index e48796b98c0..258fe78ecab 100644
--- a/module/VuFind/tests/unit-tests/src/VuFindTest/Role/DynamicRoleProviderTest.php
+++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Role/DynamicRoleProviderTest.php
@@ -101,7 +101,7 @@ class DynamicRoleProviderTest extends \VuFindTest\Unit\TestCase
      */
     protected function getFakePluginManager()
     {
-        $pm = new PluginManager();
+        $pm = new PluginManager($this->getServiceManager());
         foreach (['a', 'b', 'c'] as $name) {
             $pm->setService($name, $this->createMock('VuFind\Role\PermissionProvider\PermissionProviderInterface'));
         }
-- 
GitLab