ExporterTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /*
  3. * This file is part of the Sonata package.
  4. *
  5. * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Sonata\AdminBundle\Tests\Filter;
  11. use Sonata\AdminBundle\Export\Exporter;
  12. use Exporter\Source\SourceIteratorInterface;
  13. use Exporter\Source\ArraySourceIterator;
  14. use Symfony\Component\HttpFoundation\Response;
  15. class ExporterTest extends \PHPUnit_Framework_TestCase
  16. {
  17. /**
  18. * @expectedException RuntimeException
  19. */
  20. public function testFilter()
  21. {
  22. $source = $this->getMock('Exporter\Source\SourceIteratorInterface');
  23. $exporter = new Exporter();
  24. $exporter->getResponse('foo', 'foo', $source);
  25. }
  26. public function testJsonFormat()
  27. {
  28. $source = new ArraySourceIterator(array(
  29. array('foo' => 'bar')
  30. ));
  31. $exporter = new Exporter();
  32. $response = $exporter->getResponse('json', 'foo.json', $source);
  33. $this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
  34. }
  35. }