| 1 |
<?php |
| 2 |
|
| 3 |
namespace ResponsiveMenu\ViewModels\Components\Menu; |
| 4 |
use PHPUnit\Framework\TestCase; |
| 5 |
use ResponsiveMenu\Models\Option; |
| 6 |
|
| 7 |
class MenuTest extends TestCase { |
| 8 |
|
| 9 |
public function setUp() { |
| 10 |
|
| 11 |
function wp_nav_menu($args) { |
| 12 |
return $args; |
| 13 |
} |
| 14 |
|
| 15 |
$this->translator = $this->createMock('ResponsiveMenu\Translation\Translator'); |
| 16 |
$this->component = new Menu($this->translator); |
| 17 |
} |
| 18 |
|
| 19 |
public function testRender() { |
| 20 |
$collection = new \ResponsiveMenu\Collections\OptionsCollection; |
| 21 |
$collection->add(new Option('menu_to_use', 'b')); |
| 22 |
$collection->add(new Option('theme_location_menu', 'b')); |
| 23 |
$collection->add(new Option('menu_depth', 'b')); |
| 24 |
$collection->add(new Option('custom_walker', '\StdClass')); |
| 25 |
$this->translator->method('translate')->willReturn('b'); |
| 26 |
$args = $this->component->render($collection); |
| 27 |
$this->assertEquals('', $args['container']); |
| 28 |
$this->assertEquals('responsive-menu', $args['menu_id']); |
| 29 |
$this->assertNull($args['menu_class']); |
| 30 |
$this->assertNull($args['menu']); |
| 31 |
$this->assertEquals('b', $args['depth']); |
| 32 |
$this->assertEquals('b', $args['theme_location']); |
| 33 |
$this->assertFalse($args['echo']); |
| 34 |
} |
| 35 |
|
| 36 |
} |
| 37 |
|