AdminSearchBlockServiceTest.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /*
  3. * This file is part of the Sonata Project 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\Block;
  11. use Sonata\AdminBundle\Admin\Pool;
  12. use Sonata\AdminBundle\Block\AdminSearchBlockService;
  13. use Sonata\AdminBundle\Search\SearchHandler;
  14. use Sonata\BlockBundle\Test\AbstractBlockServiceTestCase;
  15. /**
  16. * @author Sullivan Senechal <soullivaneuh@gmail.com>
  17. */
  18. class AdminSearchBlockServiceTest extends AbstractBlockServiceTestCase
  19. {
  20. /**
  21. * @var Pool
  22. */
  23. private $pool;
  24. /**
  25. * @var SearchHandler
  26. */
  27. private $searchHandler;
  28. protected function setUp()
  29. {
  30. parent::setUp();
  31. $this->pool = $this->getMockBuilder('Sonata\AdminBundle\Admin\Pool')->disableOriginalConstructor()->getMock();
  32. $this->searchHandler = $this->getMockBuilder('Sonata\AdminBundle\Search\SearchHandler')->disableOriginalConstructor()->getMock();
  33. }
  34. public function testDefaultSettings()
  35. {
  36. $blockService = new AdminSearchBlockService('foo', $this->templating, $this->pool, $this->searchHandler);
  37. $blockContext = $this->getBlockContext($blockService);
  38. $this->assertSettings(array(
  39. 'admin_code' => false,
  40. 'query' => '',
  41. 'page' => 0,
  42. 'per_page' => 10,
  43. 'icon' => '<i class="fa fa-list"></i>',
  44. ), $blockContext);
  45. }
  46. }