GraphNavigatorTest.php 1008 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace JMS\SerializerBundle\Tests\Serializer;
  3. use Doctrine\Common\Annotations\AnnotationReader;
  4. use JMS\SerializerBundle\Metadata\Driver\AnnotationDriver;
  5. use JMS\SerializerBundle\Serializer\GraphNavigator;
  6. use Metadata\MetadataFactory;
  7. class GraphNavigatorTest extends \PHPUnit_Framework_TestCase
  8. {
  9. private $metadataFactory;
  10. private $navigator;
  11. private $visitor;
  12. /**
  13. * @expectedException \RuntimeException
  14. * @expectedExceptionMessage Resources are not supported in serialized data.
  15. */
  16. public function testResourceThrowsException()
  17. {
  18. $this->navigator->accept(STDIN, null, $this->visitor);
  19. }
  20. protected function setUp()
  21. {
  22. $this->visitor = $this->getMock('JMS\SerializerBundle\Serializer\VisitorInterface');
  23. $this->metadataFactory = new MetadataFactory(new AnnotationDriver(new AnnotationReader()));
  24. $this->navigator = new GraphNavigator(GraphNavigator::DIRECTION_SERIALIZATION, $this->metadataFactory);
  25. }
  26. }