示例#1
0
 public function testOnScrollDataBefore()
 {
     /** @var \Twig_Environment $environment */
     $environment = $this->getMock('\\Twig_Environment');
     $pageIdentifier = 'test-page';
     $data = new ScrollData(['fields']);
     $alteredData = new ScrollData(['altered', 'fields']);
     /** @var FormView $formView */
     $formView = $this->getMock('Symfony\\Component\\Form\\FormView');
     $this->eventDispatcher->expects($this->once())->method('dispatch')->with('oro_ui.scroll_data.before.' . $pageIdentifier, $this->isInstanceOf('Oro\\Bundle\\UIBundle\\Event\\BeforeListRenderEvent'))->willReturnCallback(function ($name, BeforeListRenderEvent $event) use($environment, $data, $alteredData, $formView) {
         $this->assertEquals($environment, $event->getEnvironment());
         $this->assertEquals($data, $event->getScrollData());
         $this->assertEquals($formView, $event->getFormView());
         $event->setScrollData($alteredData);
     });
     $this->assertEquals($alteredData->getData(), $this->extension->scrollDataBefore($environment, $pageIdentifier, $data->getData(), $formView));
 }
 public function testGetTokenParsers()
 {
     $parsers = $this->extension->getTokenParsers();
     $this->assertTrue($parsers[0] instanceof \Oro\Bundle\UIBundle\Twig\Parser\PlaceholderTokenParser);
 }