CiviEventDispatcherTest - Fix warning on newer versions of PHP
authorTim Otten <totten@civicrm.org>
Fri, 1 May 2020 03:30:06 +0000 (20:30 -0700)
committerTim Otten <totten@civicrm.org>
Fri, 1 May 2020 03:30:06 +0000 (20:30 -0700)
tests/phpunit/Civi/Core/CiviEventDispatcherTest.php

index 5b9c6d76870024397084d383c70eda230ec8fb4d..3b1bc47fac44dc1a830f406325b4cd0fdd7a4d46 100644 (file)
@@ -20,7 +20,7 @@ class CiviEventDispatcherTest extends \CiviUnitTestCase {
     $d->addListener('hook_civicrm_fakeRunnable', function() use (&$calls) {
       $calls['hook_civicrm_fakeRunnable'] = 1;
     });
-    $d->dispatch('hook_civicrm_fakeRunnable', new GenericHookEvent());
+    $d->dispatch('hook_civicrm_fakeRunnable', GenericHookEvent::create([]));
     $this->assertEquals(1, $calls['hook_civicrm_fakeRunnable']);
   }
 
@@ -33,7 +33,7 @@ class CiviEventDispatcherTest extends \CiviUnitTestCase {
     $d->addListener('hook_civicrm_fakeDroppable', function() use (&$calls) {
       $calls['hook_civicrm_fakeDroppable'] = 1;
     });
-    $d->dispatch('hook_civicrm_fakeDroppable', new GenericHookEvent());
+    $d->dispatch('hook_civicrm_fakeDroppable', GenericHookEvent::create([]));
     $this->assertTrue(!isset($calls['hook_civicrm_fakeDroppable']));
   }
 
@@ -43,7 +43,7 @@ class CiviEventDispatcherTest extends \CiviUnitTestCase {
       '/^hook_civicrm_fakeFa/' => 'fail',
     ]);
     try {
-      $d->dispatch('hook_civicrm_fakeFailure', new GenericHookEvent());
+      $d->dispatch('hook_civicrm_fakeFailure', GenericHookEvent::create([]));
       $this->fail('Expected exception');
     }
     catch (\Exception $e) {