'Rest export display', 'description' => 'Tests the rest export display.', 'group' => 'Routing', ); } /** * Tests collectRoutes. * * @see \Drupal\rest\Plugin\views\display\RestExport::collectRoutes() */ public function testCollectRoutes() { $serializer = new Serializer(array(), array()); $serializer_style = new StyleSerializer(array(), 'serializer', array(), $serializer, array()); $container = new Container(); $style_plugin_manager = $this->getMockBuilder('Drupal\views\Plugin\ViewsPluginManager') ->disableOriginalConstructor() ->getMock() ->expects($this->once()) ->method('createInstance') ->with($this->equalTo('serializer')) ->will($this->returnValue($serializer_style)); $container->set('plugin.manager.views.style', $style_plugin_manager); $rest_export = new RestExport(array(), 'rest_export', array()); $executable = $this->getMockBuilder('Drupal\views\ViewExecutable') ->disableOriginalConstructor() ->getMock(); $display = array('id' => 'default'); $options = array('style' => array('serializer')); $rest_export->initDisplay($executable, $display, $options); $collection = new RouteCollection(); $collection->add('view.test_view.default', new Route('/test-view')); $rest_export->collectRoutes($collection); print_r($collection->get('view.test_view.default')); } }