failing test for php 7.4 and IDS
authordemeritcowboy <demeritcowboy@hotmail.com>
Sat, 20 Mar 2021 02:58:11 +0000 (22:58 -0400)
committerdemeritcowboy <demeritcowboy@hotmail.com>
Sat, 20 Mar 2021 02:58:11 +0000 (22:58 -0400)
tests/phpunit/CRM/Core/InvokeTest.php [new file with mode: 0644]

diff --git a/tests/phpunit/CRM/Core/InvokeTest.php b/tests/phpunit/CRM/Core/InvokeTest.php
new file mode 100644 (file)
index 0000000..a78add4
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC. All rights reserved.                        |
+ |                                                                    |
+ | This work is published under the GNU AGPLv3 license with some      |
+ | permitted exceptions and without any warranty. For full license    |
+ | and copyright information, see https://civicrm.org/licensing       |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ * @group headless
+ */
+class CRM_Core_InvokeTest extends CiviUnitTestCase {
+
+  /**
+   * Test that no php errors come up invoking dashboard url for non-admins
+   * Motivation: This currently fails on php 7.4 because of IDS and magicquotes.
+   */
+  public function testInvokeDashboardForNonAdmin(): void {
+    CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM'];
+
+    $_SERVER['REQUEST_URI'] = 'civicrm/dashboard?reset=1';
+    $_GET['q'] = 'civicrm/dashboard';
+
+    $item = CRM_Core_Invoke::getItem(['civicrm/dashboard?reset=1']);
+    ob_start();
+    CRM_Core_Invoke::runItem($item);
+    ob_end_clean();
+  }
+
+}