X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FPage%2FQUnit.php;h=d97ba0012d6bc521aeaf74138c9ea145002aabd3;hb=26c9d07d76761b9c771ecd5cb1760438a6b30d87;hp=ae1c90c3441adc8fb5ed1cd8a40a70b91efe373c;hpb=d6c79fecdf83fb0ee72271aa678e35ddf7a236b2;p=civicrm-core.git diff --git a/CRM/Core/Page/QUnit.php b/CRM/Core/Page/QUnit.php index ae1c90c344..d97ba0012d 100644 --- a/CRM/Core/Page/QUnit.php +++ b/CRM/Core/Page/QUnit.php @@ -15,6 +15,13 @@ class CRM_Core_Page_QUnit extends CRM_Core_Page { * @throws \CRM_Core_Exception */ public function run() { + $qunitJsFile = Civi::paths()->getPath('[civicrm.bower]/qunit/qunit/qunit.js'); + $qunitJsUrl = Civi::paths()->getUrl('[civicrm.bower]/qunit/qunit/qunit.js'); + $qunitCssUrl = Civi::paths()->getUrl('[civicrm.bower]/qunit/qunit/qunit.css'); + if (!file_exists($qunitJsFile)) { + throw new \CRM_Core_Exception("QUnit is not available. Please install it in [civicrm.bower]/qunit."); + } + list ($ext, $suite) = $this->getRequestExtAndSuite(); if (empty($ext) || empty($suite)) { throw new CRM_Core_Exception("FIXME: Not implemented: QUnit browser"); @@ -45,8 +52,8 @@ class CRM_Core_Page_QUnit extends CRM_Core_Page { CRM_Utils_System::setTitle(ts('QUnit: %2 (%1)', [1 => $ext, 2 => $suite])); CRM_Core_Resources::singleton() - ->addScriptFile('civicrm', 'bower_components/qunit/qunit/qunit.js', 1, 'html-header') - ->addStyleFile('civicrm', 'bower_components/qunit/qunit/qunit.css', 1, 'html-header'); + ->addScriptUrl($qunitJsUrl, 1, 'html-header') + ->addStyleUrl($qunitCssUrl, 1, 'html-header'); parent::run(); } @@ -56,8 +63,7 @@ class CRM_Core_Page_QUnit extends CRM_Core_Page { * @return array */ public function getRequestExtAndSuite() { - $config = CRM_Core_Config::singleton(); - $arg = explode('/', $_GET[$config->userFrameworkURLVar]); + $arg = explode('/', CRM_Utils_System::currentPath()); if ($arg[1] == 'dev' && CRM_Utils_Array::value(2, $arg) == 'qunit'