<commit_before><?php

namespace cmstests\src\frontend\blocks;

use cmstests\BlockTestCase;

class LinkButtonBlockTest extends BlockTestCase
{
    public $blockClass = 'luya\cms\frontend\blocks\LinkButtonBlock';
    
    public function testEmptyRender()
    {
        $this->assertSame('', $this->renderFrontendNoSpace());
    }
    
    public function testLinkLinkSource()
    {
        $this->block->setVarValues([
            'linkData' => ['type' => 2, 'value' => 'https://luya.io']
        ]);
        $this->assertSame('<a class="btn btn-default" href="https://luya.io"></a>', $this->renderFrontendNoSpace());
    }
    
    public function testLinkLinkSourceWithLabel()
    {
        $this->block->setVarValues(['label' => 'label', 'linkData' => ['type' => 2, 'value' => 'https://luya.io']]);
        $this->assertSame('<a class="btn btn-default" href="https://luya.io">label</a>', $this->renderFrontendNoSpace());
    }
    
    public function testLinkLinkSourceWithLabelBlank()
    {
        $this->block->setVarValues(['label' => 'label', 'linkData' => ['type' => 2, 'value' => 'https://luya.io']]);
        $this->block->setCfgValues(['targetBlank' => 1]);
        $this->assertSame('<a class="btn btn-default" href="https://luya.io" target="_blank">label</a>', $this->renderFrontendNoSpace());
    }
    
    public function testLinkLinkSourceWithLabelBlankSimpleLink()
    {
        $this->block->setVarValues(['label' => 'label', 'linkData' => ['type' => 2, 'value' => 'https://luya.io']]);
        $this->block->setCfgValues(['targetBlank' => 1, 'simpleLink' => 1]);
        $this->assertSame('<a href="https://luya.io" target="_blank">label</a>', $this->renderFrontendNoSpace());
    }<commit_msg>fixed unit test based on new link directive #1534<commit_after><?php

namespace cmstests\src\frontend\blocks;

use cmstests\BlockTestCase;

class LinkButtonBlockTest extends BlockTestCase
{
    public $blockClass = 'luya\cms\frontend\blocks\LinkButtonBlock';
    
    public function testEmptyRender()
    {
        $this->assertSame('', $this->renderFrontendNoSpace());
    }
    
    public function testLinkLinkSource()
    {
        $this->block->setVarValues([
            'linkData' => ['type' => 2, 'value' => 'https://luya.io']
        ]);
        $this->assertSame('<a class="btn btn-default" href="https://luya.io" target="_blank"></a>', $this->renderFrontendNoSpace());
    }
    
    public function testLinkLinkSourceWithLabel()
    {
        $this->block->setVarValues(['label' => 'label', 'linkData' => ['type' => 2, 'value' => 'https://luya.io']]);
        $this->assertSame('<a class="btn btn-default" href="https://luya.io" target="_blank">label</a>', $this->renderFrontendNoSpace());
    }
    
    public function testLinkLinkSourceWithLabelBlank()
    {
        $this->block->setVarValues(['label' => 'label', 'linkData' => ['type' => 2, 'value' => 'https://luya.io']]);
        $this->block->setCfgValues(['targetBlank' => 1]);
        $this->assertSame('<a class="btn btn-default" href="https://luya.io" target="_blank">label</a>', $this->renderFrontendNoSpace());
    }
    
    public function testLinkLinkSourceWithLabelBlankSimpleLink()
    {
        $this->block->setVarValues(['label' => 'label', 'linkData' => ['type' => 2, 'value' => 'https://luya.io']]);
        $this->block->setCfgValues(['targetBlank' => 1, 'simpleLink' => 1]);
        $this->assertSame('<a href="https://luya.io" target="_blank">label</a>', $this->renderFrontendNoSpace());
    }
{'fraction_non_alphanumeric': 0.20497427101200685, 'fraction_numerical': 0.005145797598627788, 'mean_word_length': 3.6221928665785996, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 99, 'https://': 16, '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': '6077935', 'n_tokens_mistral': 1130, 'n_tokens_neox': 1099, 'n_words': 174}