From 1c80cf3a0d005f1847f9bc871f4e1babb637bcd1 Mon Sep 17 00:00:00 2001 From: demeritcowboy Date: Tue, 24 Aug 2021 18:01:15 -0400 Subject: [PATCH] replace deprecated function --- tests/phpunit/Civi/Angular/LoaderTest.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/Civi/Angular/LoaderTest.php b/tests/phpunit/Civi/Angular/LoaderTest.php index 029daef6aa..daccaa74bb 100644 --- a/tests/phpunit/Civi/Angular/LoaderTest.php +++ b/tests/phpunit/Civi/Angular/LoaderTest.php @@ -46,11 +46,16 @@ class LoaderTest extends \CiviUnitTestCase { * @param $expectedPermissions */ public function testSettingFactory($module, $expectedSettingCount, $expectedCallbackCount, $expectedPermissions) { - $loader = new \Civi\Angular\AngularLoader(); + $loader = \Civi::service('angularjs.loader'); $loader->addModules([$module]); $loader->useApp(); - // Load triggers a deprecation notice, use @ to suppress it for the test. - @$loader->load(); + + // Load angular resources. + // + // It seems like calling something like + // \CRM_Core_Region::instance('html-header')->render(''); + // would be more realistic but then the test fails. Maybe a future todo. + \Civi::dispatcher()->dispatch('civi.region.render', \Civi\Core\Event\GenericHookEvent::create(['region' => \CRM_Core_Region::instance('html-header')])); // Run factory callbacks $actual = \Civi::resources()->getSettings(); -- 2.25.1