<commit_before><?php

require_once CM_Util::getModulePath('CM') . 'library/CM/SmartyPlugins/function.button_link.php';

class smarty_function_button_linkTest extends CMTest_TestCase {

    /** @var CM_Frontend_Render */
    private $_render;

    /** @var Smarty_Internal_Template */
    private $_template;

    public function setUp() {
        $smarty = new Smarty();
        $this->_render = new CM_Frontend_Render();
        $this->_template = $smarty->createTemplate('string:');
        $this->_template->assignGlobal('render', $this->_render);
    }

    public function testRender() {
        $params = array(
            'action' => 'Create',
            'label'  => 'Some text <br /> with html tags',
            'theme'  => 'highlight',
            'class'  => 'button-large',
        );

        $this->_assertContains('value="<span class="label">Some text <br /> with html tags</span>"', array_merge($params, array('isHtmlLabel' => true)));
        $this->_assertContains('<span class="label">Some text <br /> with html tags</span>', array_merge($params, array('isHtmlLabel' => true)));
        $this->_assertContains('value="Some text &lt;br /&gt; with html tags"', array_merge($params, array('isHtmlLabel' => false)));
        $this->_assertContains('<span class="label">Some text &lt;br /&gt; with html tags</span>', array_merge($params, array('isHtmlLabel' => false)));
    }

    public function testRenderHref() {<commit_msg>Fix test<commit_after><?php

require_once CM_Util::getModulePath('CM') . 'library/CM/SmartyPlugins/function.button_link.php';

class smarty_function_button_linkTest extends CMTest_TestCase {

    /** @var CM_Frontend_Render */
    private $_render;

    /** @var Smarty_Internal_Template */
    private $_template;

    public function setUp() {
        $smarty = new Smarty();
        $this->_render = new CM_Frontend_Render();
        $this->_template = $smarty->createTemplate('string:');
        $this->_template->assignGlobal('render', $this->_render);
    }

    public function testRender() {
        $params = array(
            'action' => 'Create',
            'label'  => 'Some text <br /> with html tags',
            'theme'  => 'highlight',
            'class'  => 'button-large',
        );

        $this->_assertContains('value="Some text &lt;br /&gt; with html tags"', array_merge($params, array('isHtmlLabel' => true)));
        $this->_assertContains('<span class="label">Some text <br /> with html tags</span>', array_merge($params, array('isHtmlLabel' => true)));
        $this->_assertContains('value="Some text &lt;br /&gt; with html tags"', array_merge($params, array('isHtmlLabel' => false)));
        $this->_assertContains('<span class="label">Some text &lt;br /&gt; with html tags</span>', array_merge($params, array('isHtmlLabel' => false)));
    }

    public function testRenderHref() {
{'fraction_non_alphanumeric': 0.16981132075471697, 'fraction_numerical': 0.0, 'mean_word_length': 3.459501557632399, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 54, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1690832', 'n_tokens_mistral': 839, 'n_tokens_neox': 830, 'n_words': 183}