X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fapi%2Fv3%2FDashboardTest.php;h=e9f5169fa24edd09a68a9e9cef3003c9990a1b69;hb=3d023ead1624cb26e8c5685b8a58f49690c31da3;hp=bbc33cbb424ee7151918c71827288b954061c2c9;hpb=ef534103ef408bec8dea63bc49dea15dd867d23a;p=civicrm-core.git diff --git a/tests/phpunit/api/v3/DashboardTest.php b/tests/phpunit/api/v3/DashboardTest.php index bbc33cbb42..e9f5169fa2 100644 --- a/tests/phpunit/api/v3/DashboardTest.php +++ b/tests/phpunit/api/v3/DashboardTest.php @@ -61,6 +61,28 @@ class api_v3_DashboardTest extends CiviUnitTestCase { $this->assertEquals($dashboard['values'][$dashboard['id']]['is_active'], 1); } + /** + * CRM-19534. + * + * Ensure that Dashboard create works fine for non admins + */ + public function testDashboardCreateByNonAdmins() { + $loggedInContactID = $this->createLoggedInUser(); + CRM_Core_Config::singleton()->userPermissionClass->permissions = array(); + $params = array( + 'label' => 'New Dashlet element', + 'name' => 'New Dashlet element', + 'url' => 'civicrm/report/list&reset=1&compid=99', + 'fullscreen_url' => 'civicrm/report/list&compid=99&reset=1&context=dashletFullscreen', + ); + $dashboard = $this->callAPISuccess('dashboard', 'create', $params); + $this->assertTrue(is_numeric($dashboard['id']), "In line " . __LINE__); + $this->assertTrue($dashboard['id'] > 0, "In line " . __LINE__); + + $this->callAPISuccess('dashboard', 'create', $params); + $this->assertEquals($dashboard['values'][$dashboard['id']]['is_active'], 1); + } + /** * CRM-19217. *