We have a winner', ['fa-trophy', 'We have a winner', TRUE, []], '{icon icon="fa-trophy"}We have a winner{/icon}', ], [ '', ['fa-trophy', 'We have a winner', 0, []], '{icon icon="fa-trophy" condition=0}We have a winner{/icon}', ], [ 'Favorite', ['fa-heart', 'Favorite', TRUE, ['class' => 'action-icon test-icon']], '{icon icon="fa-heart" class="action-icon test-icon"}Favorite{/icon}', ], [ 'I "choo-choo" choose you', ['fa-train', 'I "choo-choo" choose you', TRUE, []], '{icon icon="fa-train"}I "choo-choo" choose you{/icon}', ], [ 'Trash', ['fa-trash', 'Trash', TRUE, ['title' => '']], '{icon icon="fa-trash" title=""}Trash{/icon}', ], [ 'It\'s bedtime', ['fa-bed', "It's bedtime", TRUE, ['aria-hidden' => '']], // Ye olde Smarty 2 doesn't support hyphenated function parameters ], [ '', ['fa-snowflake-o', NULL, TRUE, []], '{icon icon="fa-snowflake-o"}{/icon}', ], ]; } /** * Test that icons are formed properly * * @param string $expectedMarkup * @param array $params * @param string $smartyFunc * @dataProvider iconTestData */ public function testMakeIcons($expectedMarkup, $params, $smartyFunc = '') { list($icon, $text, $condition, $attribs) = $params; $this->assertEquals($expectedMarkup, CRM_Core_Page::crmIcon($icon, $text, $condition, $attribs)); if (!empty($smartyFunc)) { $smarty = CRM_Core_Smarty::singleton(); $actual = $smarty->fetch('string:' . $smartyFunc); $this->assertEquals($expectedMarkup, $actual, "Process input=[$smartyFunc]"); } } }