(NFC) Change getMock to createMock in tests to fix deprecated warning on getMock...
authorSeamus Lee <seamuslee001@gmail.com>
Sat, 5 May 2018 06:16:13 +0000 (16:16 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Sat, 5 May 2018 23:09:29 +0000 (09:09 +1000)
tests/phpunit/CRM/Core/CommunityMessagesTest.php
tests/phpunit/CRM/Core/JobManagerTest.php
tests/phpunit/CRM/Extension/ManagerTest.php
tests/phpunit/api/v3/ContactTest.php

index 0ce30a66abc5b7f45d0eb3c83e28b5ee09fe0942..0732ad1f9d9290142ed932140017850b74e110b1 100644 (file)
@@ -377,7 +377,7 @@ class CRM_Core_CommunityMessagesTest extends CiviUnitTestCase {
    * @return CRM_Utils_HttpClient|PHPUnit_Framework_MockObject_MockObject
    */
   protected function expectNoHttpRequest() {
-    $client = $this->getMock('CRM_Utils_HttpClient');
+    $client = $this->createMock('CRM_Utils_HttpClient');
     $client->expects($this->never())
       ->method('get');
     return $client;
@@ -391,7 +391,7 @@ class CRM_Core_CommunityMessagesTest extends CiviUnitTestCase {
    * @return CRM_Utils_HttpClient|PHPUnit_Framework_MockObject_MockObject
    */
   protected function expectOneHttpRequest($response) {
-    $client = $this->getMock('CRM_Utils_HttpClient');
+    $client = $this->createMock('CRM_Utils_HttpClient');
     $client->expects($this->once())
       ->method('get')
       ->will($this->returnValue($response));
index f67aa2635ed941c889a42353e374465456e5aa68..3b5453fd3b6d3b8105ce4d8dda58443a64904918 100644 (file)
@@ -36,7 +36,7 @@ class CRM_Core_JobManagerTest extends CiviUnitTestCase {
   }
 
   public function testHookCron() {
-    $hook = $this->getMock('stdClass', array('civicrm_cron'));
+    $hook = $this->createMock('stdClass', array('civicrm_cron'));
     $hook->expects($this->once())
       ->method('civicrm_cron')
       ->with($this->isInstanceOf('CRM_Core_JobManager'));
index ece4e8bf5d6849c2ba977bfd65e4f20c14684620..419d48756cb59fe9a3d14feecad2fa0fcc1f6465 100644 (file)
@@ -49,7 +49,7 @@ class CRM_Extension_ManagerTest extends CiviUnitTestCase {
    * @expectedException CRM_Extension_Exception
    */
   public function testInstallInvalidType() {
-    $testingTypeManager = $this->getMock('CRM_Extension_Manager_Interface');
+    $testingTypeManager = $this->createMock('CRM_Extension_Manager_Interface');
     $testingTypeManager->expects($this->never())
       ->method('onPreInstall');
     $manager = $this->_createManager(array(
@@ -66,7 +66,7 @@ class CRM_Extension_ManagerTest extends CiviUnitTestCase {
    * "the first row" or "all rows".
    */
   public function testInstall_Disable_Uninstall() {
-    $testingTypeManager = $this->getMock('CRM_Extension_Manager_Interface');
+    $testingTypeManager = $this->createMock('CRM_Extension_Manager_Interface');
     $manager = $this->_createManager(array(
       self::TESTING_TYPE => $testingTypeManager,
     ));
@@ -110,7 +110,7 @@ class CRM_Extension_ManagerTest extends CiviUnitTestCase {
    * @throws \CRM_Extension_Exception
    */
   public function test_InstallAuto_DisableDownstream_UninstallDownstream() {
-    $testingTypeManager = $this->getMock('CRM_Extension_Manager_Interface');
+    $testingTypeManager = $this->createMock('CRM_Extension_Manager_Interface');
     $manager = $this->_createManager(array(
       self::TESTING_TYPE => $testingTypeManager,
     ));
@@ -151,7 +151,7 @@ class CRM_Extension_ManagerTest extends CiviUnitTestCase {
    * @throws \CRM_Extension_Exception
    */
   public function testInstallAuto_Twice() {
-    $testingTypeManager = $this->getMock('CRM_Extension_Manager_Interface');
+    $testingTypeManager = $this->createMock('CRM_Extension_Manager_Interface');
     $manager = $this->_createManager(array(
       self::TESTING_TYPE => $testingTypeManager,
     ));
@@ -180,7 +180,7 @@ class CRM_Extension_ManagerTest extends CiviUnitTestCase {
   }
 
   public function test_InstallAuto_DisableUpstream() {
-    $testingTypeManager = $this->getMock('CRM_Extension_Manager_Interface');
+    $testingTypeManager = $this->createMock('CRM_Extension_Manager_Interface');
     $manager = $this->_createManager(array(
       self::TESTING_TYPE => $testingTypeManager,
     ));
@@ -223,7 +223,7 @@ class CRM_Extension_ManagerTest extends CiviUnitTestCase {
    * Subseuently disable and uninstall.
    */
   public function testInstall_DirtyRemove_Disable_Uninstall() {
-    $testingTypeManager = $this->getMock('CRM_Extension_Manager_Interface');
+    $testingTypeManager = $this->createMock('CRM_Extension_Manager_Interface');
     $manager = $this->_createManager(array(
       self::TESTING_TYPE => $testingTypeManager,
     ));
@@ -261,7 +261,7 @@ class CRM_Extension_ManagerTest extends CiviUnitTestCase {
    * Install an extension with a valid type name.
    */
   public function testInstall_Disable_Enable() {
-    $testingTypeManager = $this->getMock('CRM_Extension_Manager_Interface');
+    $testingTypeManager = $this->createMock('CRM_Extension_Manager_Interface');
     $manager = $this->_createManager(array(
       self::TESTING_TYPE => $testingTypeManager,
     ));
@@ -303,7 +303,7 @@ class CRM_Extension_ManagerTest extends CiviUnitTestCase {
    * Performing 'install' on a 'disabled' extension performs an 'enable'
    */
   public function testInstall_Disable_Install() {
-    $testingTypeManager = $this->getMock('CRM_Extension_Manager_Interface');
+    $testingTypeManager = $this->createMock('CRM_Extension_Manager_Interface');
     $manager = $this->_createManager(array(
       self::TESTING_TYPE => $testingTypeManager,
     ));
@@ -341,7 +341,7 @@ class CRM_Extension_ManagerTest extends CiviUnitTestCase {
    * Install an extension with a valid type name.
    */
   public function testEnableBare() {
-    $testingTypeManager = $this->getMock('CRM_Extension_Manager_Interface');
+    $testingTypeManager = $this->createMock('CRM_Extension_Manager_Interface');
     $manager = $this->_createManager(array(
       self::TESTING_TYPE => $testingTypeManager,
     ));
@@ -367,7 +367,7 @@ class CRM_Extension_ManagerTest extends CiviUnitTestCase {
    * Get the status of an unknown extension.
    */
   public function testStatusUnknownKey() {
-    $testingTypeManager = $this->getMock('CRM_Extension_Manager_Interface');
+    $testingTypeManager = $this->createMock('CRM_Extension_Manager_Interface');
     $testingTypeManager->expects($this->never())
       ->method('onPreInstall');
     $manager = $this->_createManager(array(
@@ -380,7 +380,7 @@ class CRM_Extension_ManagerTest extends CiviUnitTestCase {
    * Replace code for an extension that doesn't exist in the container
    */
   public function testReplace_Unknown() {
-    $testingTypeManager = $this->getMock('CRM_Extension_Manager_Interface');
+    $testingTypeManager = $this->createMock('CRM_Extension_Manager_Interface');
     $manager = $this->_createManager(array(
       self::TESTING_TYPE => $testingTypeManager,
     ));
@@ -406,7 +406,7 @@ class CRM_Extension_ManagerTest extends CiviUnitTestCase {
    * Replace code for an extension that doesn't exist in the container
    */
   public function testReplace_Uninstalled() {
-    $testingTypeManager = $this->getMock('CRM_Extension_Manager_Interface');
+    $testingTypeManager = $this->createMock('CRM_Extension_Manager_Interface');
     $manager = $this->_createManager(array(
       self::TESTING_TYPE => $testingTypeManager,
     ));
@@ -437,7 +437,7 @@ class CRM_Extension_ManagerTest extends CiviUnitTestCase {
    * file="oddball", and the upgrade has file="newextension".
    */
   public function testReplace_Installed() {
-    $testingTypeManager = $this->getMock('CRM_Extension_Manager_Interface');
+    $testingTypeManager = $this->createMock('CRM_Extension_Manager_Interface');
     $manager = $this->_createManager(array(
       self::TESTING_TYPE => $testingTypeManager,
     ));
@@ -474,7 +474,7 @@ class CRM_Extension_ManagerTest extends CiviUnitTestCase {
    * file="oddball", and the upgrade has file="newextension".
    */
   public function testReplace_InstalledMissing() {
-    $testingTypeManager = $this->getMock('CRM_Extension_Manager_Interface');
+    $testingTypeManager = $this->createMock('CRM_Extension_Manager_Interface');
     $manager = $this->_createManager(array(
       self::TESTING_TYPE => $testingTypeManager,
     ));
index e7a714b6d604f58243868570732cc5b24ee61f06..fb2e19c7eebdba4ef615caa32244ba727a0500ee 100644 (file)
@@ -2036,7 +2036,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     $this->assertTrue(is_numeric($ufMatch->id));
 
     // setup - mock the calls to CRM_Utils_System_*::getUfId
-    $userSystem = $this->getMock('CRM_Utils_System_UnitTests', array('getUfId'));
+    $userSystem = $this->createMock('CRM_Utils_System_UnitTests', array('getUfId'));
     $userSystem->expects($this->once())
       ->method('getUfId')
       ->with($this->equalTo('exampleUser'))
@@ -2111,7 +2111,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
    */
   public function testContactGetByUnknownUsername() {
     // setup - mock the calls to CRM_Utils_System_*::getUfId
-    $userSystem = $this->getMock('CRM_Utils_System_UnitTests', array('getUfId'));
+    $userSystem = $this->createMock('CRM_Utils_System_UnitTests', array('getUfId'));
     $userSystem->expects($this->once())
       ->method('getUfId')
       ->with($this->equalTo('exampleUser'))