SolariumQuerySubscriberTest.php 991 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace Test\Pager\Subscriber\Paginate;
  3. use Knp\Component\Pager\Paginator;
  4. use Symfony\Component\EventDispatcher\EventDispatcher;
  5. use Knp\Component\Pager\Pagination\PaginationInterface;
  6. use Knp\Component\Pager\Event\Subscriber\Paginate\ArraySubscriber;
  7. use Knp\Component\Pager\Event\Subscriber\Paginate\SolariumQuerySubscriber;
  8. use Test\Mock\PaginationSubscriber as MockPaginationSubscriber;
  9. class SolariumQuerySubscriberTest extends \PHPUnit_Framework_TestCase
  10. {
  11. /**
  12. * @test
  13. * @expectedException RuntimeException
  14. * @expectedExceptionMessage One of listeners must count and slice given target
  15. */
  16. function testArrayShouldNotBeHandled()
  17. {
  18. $array = array(1 => 'foo', 2 => 'bar');
  19. $dispatcher = new EventDispatcher;
  20. $dispatcher->addSubscriber(new SolariumQuerySubscriber);
  21. $dispatcher->addSubscriber(new MockPaginationSubscriber);
  22. $p = new Paginator($dispatcher);
  23. $p->paginate($array, 1, 10);
  24. }
  25. }