Merge pull request #19628 from vakeesan26/master
[civicrm-core.git] / tests / phpunit / CRM / Core / InvokeTest.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
10 */
11
12 /**
13 * @group headless
14 */
15 class CRM_Core_InvokeTest extends CiviUnitTestCase {
16
17 /**
18 * Test that no php errors come up invoking dashboard url for non-admins
19 * Motivation: This currently fails on php 7.4 because of IDS and magicquotes.
20 */
21 public function testInvokeDashboardForNonAdmin(): void {
22 CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM'];
23
24 $_SERVER['REQUEST_URI'] = 'civicrm/dashboard?reset=1';
25 $_GET['q'] = 'civicrm/dashboard';
26
27 $item = CRM_Core_Invoke::getItem(['civicrm/dashboard?reset=1']);
28 ob_start();
29 CRM_Core_Invoke::runItem($item);
30 ob_end_clean();
31 }
32
33 }