Skip to content

Commit

Permalink
Added Unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
pradpnayak committed Sep 6, 2019
1 parent 77d0bf4 commit ee73c68
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/phpunit/CRM/Core/ResourcesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -432,4 +432,28 @@ public function testIsFullyFormedUrl($url, $expected) {
$this->assertEquals($expected, CRM_Core_Resources::isFullyFormedUrl($url));
}

/**
* Test for hook_civicrm_entityRefFilters().
*
*/
public function testEntityRefFiltersHook() {
CRM_Utils_Hook_UnitTests::singleton()->setHook('civicrm_entityRefFilters', [$this, 'entityRefFilters']);
$data = CRM_Core_Resources::getEntityRefMetadata();
$this->assertEquals(count($data['links']['Contact']), 4);
$this->assertEquals(!empty($data['links']['Contact']['new_staff']), TRUE);
}

/**
* @param array $filters
* @param array $links
*/
public function entityRefFilters(&$filters, &$links) {
$links['Contact']['new_staff'] = [
'label' => ts('New Staff'),
'url' => '/civicrm/profile/create&reset=1&context=dialog&gid=5',
'type' => 'Individual',
'icon' => 'fa-user',
];
}

}

0 comments on commit ee73c68

Please sign in to comment.