| 1 |
<?php |
| 2 |
|
| 3 |
use PHPUnit\Framework\TestCase; |
| 4 |
|
| 5 |
class AdditionalContentTest extends TestCase { |
| 6 |
|
| 7 |
public function setUp() { |
| 8 |
$this->translator = $this->createMock('ResponsiveMenu\Translation\Translator'); |
| 9 |
$this->component = new ResponsiveMenu\ViewModels\Components\Menu\AdditionalContent($this->translator); |
| 10 |
} |
| 11 |
|
| 12 |
public function testRender() { |
| 13 |
$collection = new ResponsiveMenu\Collections\OptionsCollection; |
| 14 |
$collection->add(new ResponsiveMenu\Models\Option('menu_additional_content', 'b')); |
| 15 |
$this->translator->method('translate')->willReturn('b'); |
| 16 |
$this->translator->method('allowShortcode')->willReturn('b'); |
| 17 |
$this->assertEquals('<div id="responsive-menu-additional-content">b</div>', $this->component->render($collection)); |
| 18 |
} |
| 19 |
|
| 20 |
public function testRenderEmpty() { |
| 21 |
$collection = new ResponsiveMenu\Collections\OptionsCollection; |
| 22 |
$collection->add(new ResponsiveMenu\Models\Option('menu_additional_content', '')); |
| 23 |
$this->translator->method('translate')->willReturn(''); |
| 24 |
$this->translator->method('allowShortcode')->willReturn(''); |
| 25 |
$this->assertNull($this->component->render($collection)); |
| 26 |
} |
| 27 |
|
| 28 |
} |
| 29 |
|