public function testToString() { $layout = new \Dxw\Iguana\Theme\Layout(); $layout->slug = 'slug'; \WP_Mock::onFilter('roots_wrap_slug')->with(['layouts/main.php'])->reply(['layouts/my-layout.php']); \WP_Mock::wpFunction('locate_template', ['args' => [['layouts/my-layout.php']], 'return' => 'correct output']); $this->assertEquals('correct output', $layout->__toString()); }
public function testWRequestedTemplate() { $layoutRegister = new \Dxw\Iguana\Theme\LayoutRegister($this->getHelpers()); $file = \org\bovigo\vfs\vfsStream::setup()->url() . '/file.php'; file_put_contents($file, '<?php global $called; $called++;'); \Dxw\Iguana\Theme\Layout::$wordpress_template = $file; global $called; $called = 0; $layoutRegister->wRequestedTemplate(); $this->assertEquals(1, $called); }