Example #1
0
 public function testMarkupContainsCommentsWithDebugInfo()
 {
     $block = new ViewModel();
     $block->setOption('block_id', 'the.block');
     $viewModelHelper = new ModelHelper();
     $viewModelHelper->setCurrent($block);
     $filter = new DebugFilter($viewModelHelper);
     $html = '<div></div>';
     $filteredHtml = $filter->filter($html);
     $this->assertContains('<!--[the.block]', $filteredHtml);
 }
 public function testCanCheckRootModel()
 {
     $viewModel = $this->getMock(ModelInterface::class);
     $viewModelHelper = new ViewModelHelper();
     $viewModelHelper->setRoot($viewModel);
     $viewModelHelper->setCurrent($viewModel);
     $helperPluginManager = $this->getMock(HelperPluginManager::class, [], [], '', false);
     $helperPluginManager->expects($this->any())->method('get')->with('viewModel')->will($this->returnValue($viewModelHelper));
     $resourceRenderer = new ResourceRenderer($this->resolver, $helperPluginManager);
     $this->assertTrue($resourceRenderer->isRootTemplate());
     // Set another model for the current
     $viewModelHelper->setCurrent($this->getMock(ModelInterface::class));
     $this->assertFalse($resourceRenderer->isRootTemplate());
 }