| 1 |
<?php |
| 2 |
|
| 3 |
use PHPUnit\Framework\TestCase; |
| 4 |
|
| 5 |
class MenuTest extends TestCase { |
| 6 |
|
| 7 |
public function setUp() { |
| 8 |
$this->collection = new ResponsiveMenu\Collections\OptionsCollection; |
| 9 |
$this->factory = $this->createMock('ResponsiveMenu\ViewModels\Components\ComponentFactory'); |
| 10 |
$this->component = $this->createMock('ResponsiveMenu\ViewModels\Components\Menu\Title'); |
| 11 |
$this->component->method('render')->willReturn('a'); |
| 12 |
$this->factory->method('build')->willReturn($this->component); |
| 13 |
|
| 14 |
$this->menu = new ResponsiveMenu\ViewModels\Menu($this->factory); |
| 15 |
} |
| 16 |
|
| 17 |
public function testOutput() { |
| 18 |
$this->collection->add(new ResponsiveMenu\Models\Option('items_order', '{"title" : "on", "search" : "off"}')); |
| 19 |
$this->assertEquals('a', $this->menu->getHtml($this->collection)); |
| 20 |
} |
| 21 |
|
| 22 |
public function testOutputWithTwoOptionsOn() { |
| 23 |
$this->collection->add(new ResponsiveMenu\Models\Option('items_order', '{"title" : "on", "search" : "on"}')); |
| 24 |
$this->assertEquals('aa', $this->menu->getHtml($this->collection)); |
| 25 |
} |
| 26 |
|
| 27 |
public function testOutputWithOptionsOff() { |
| 28 |
$this->collection->add(new ResponsiveMenu\Models\Option('items_order', '{"title" : "off", "search" : "off"}')); |
| 29 |
$this->assertEquals('', $this->menu->getHtml($this->collection)); |
| 30 |
} |
| 31 |
|
| 32 |
} |
| 33 |
|