From: Coleman Watts Date: Wed, 16 Jun 2021 21:55:49 +0000 (-0400) Subject: AngularLoader - Emit warning when setModules method is used. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=166ed6b2b58f0c0e08983a8fdaa1ed993a11cba7;p=civicrm-core.git AngularLoader - Emit warning when setModules method is used. It can cause conflicts with other extensions who have added modules. --- diff --git a/Civi/Angular/AngularLoader.php b/Civi/Angular/AngularLoader.php index a5d6d38b57..a6b5f80a42 100644 --- a/Civi/Angular/AngularLoader.php +++ b/Civi/Angular/AngularLoader.php @@ -345,11 +345,13 @@ class AngularLoader { * Replace all previously set modules. * * Use with caution, as it can cause conflicts with other extensions who have added modules. - * + * @internal + * @deprecated * @param array $modules * @return AngularLoader */ public function setModules($modules) { + \CRM_Core_Error::deprecatedFunctionWarning('addModules'); $this->modules = $modules; return $this; } diff --git a/tests/phpunit/Civi/Angular/LoaderTest.php b/tests/phpunit/Civi/Angular/LoaderTest.php index d26e4d2e4c..029daef6aa 100644 --- a/tests/phpunit/Civi/Angular/LoaderTest.php +++ b/tests/phpunit/Civi/Angular/LoaderTest.php @@ -47,9 +47,9 @@ class LoaderTest extends \CiviUnitTestCase { */ public function testSettingFactory($module, $expectedSettingCount, $expectedCallbackCount, $expectedPermissions) { $loader = new \Civi\Angular\AngularLoader(); - $loader->setModules([$module]); + $loader->addModules([$module]); $loader->useApp(); - // Load triggers a depreaction notice, use @ to suppress it for the test. + // Load triggers a deprecation notice, use @ to suppress it for the test. @$loader->load(); // Run factory callbacks