Merge pull request #17042 from civicrm/5.25
[civicrm-core.git] / tests / phpunit / CRM / Core / BAO / IMTest.php
index d9797ff1a4200a6720670a18c868dbd5ba5bea09..cc82bd0eb02f151a36e5a74ecfba18726305f43c 100644 (file)
@@ -5,6 +5,7 @@
  * @group headless
  */
 class CRM_Core_BAO_IMTest extends CiviUnitTestCase {
+
   public function setUp() {
     parent::setUp();
   }
@@ -13,16 +14,16 @@ class CRM_Core_BAO_IMTest extends CiviUnitTestCase {
    * Add() method (create and update modes)
    */
   public function testAdd() {
-    $contactId = Contact::createIndividual();
+    $contactId = $this->individualCreate();
 
-    $params = array();
-    $params = array(
+    $params = [];
+    $params = [
       'name' => 'jane.doe',
       'provider_id' => 1,
       'is_primary' => 1,
       'location_type_id' => 1,
       'contact_id' => $contactId,
-    );
+    ];
 
     CRM_Core_BAO_IM::add($params);
 
@@ -32,13 +33,13 @@ class CRM_Core_BAO_IMTest extends CiviUnitTestCase {
 
     // Now call add() to modify an existing IM
 
-    $params = array();
-    $params = array(
+    $params = [];
+    $params = [
       'id' => $imId,
       'contact_id' => $contactId,
       'provider_id' => 3,
       'name' => 'doe.jane',
-    );
+    ];
 
     CRM_Core_BAO_IM::add($params);
 
@@ -54,11 +55,7 @@ class CRM_Core_BAO_IMTest extends CiviUnitTestCase {
    * AllIMs() method - get all IMs for our contact, with primary IM first
    */
   public function testAllIMs() {
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute(
-      $this->_dbconn,
-      $this->createFlatXMLDataSet(dirname(__FILE__) . '/dataset/im_test.xml')
-    );
+    $this->loadXMLDataSet(dirname(__FILE__) . '/dataset/im_test.xml');
 
     $contactId = 69;
     $IMs = CRM_Core_BAO_IM::allIMs($contactId);