AdminListBlockServiceTest.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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\AdminListBlockService;
  13. use Sonata\AdminBundle\Tests\Fixtures\Block\FakeBlockService;
  14. use Sonata\BlockBundle\Test\AbstractBlockServiceTestCase;
  15. /**
  16. * @author Sullivan Senechal <soullivaneuh@gmail.com>
  17. */
  18. class AdminListBlockServiceTest extends AbstractBlockServiceTestCase
  19. {
  20. /**
  21. * @var Pool
  22. */
  23. private $pool;
  24. protected function setUp()
  25. {
  26. parent::setUp();
  27. $this->pool = $this->getMockBuilder('Sonata\AdminBundle\Admin\Pool')->disableOriginalConstructor()->getMock();
  28. }
  29. public function testDefaultSettings()
  30. {
  31. $blockService = new AdminListBlockService('foo', $this->templating, $this->pool);
  32. $blockContext = $this->getBlockContext($blockService);
  33. $this->assertSettings(array(
  34. 'groups' => false,
  35. ), $blockContext);
  36. }
  37. public function testOverriddenDefaultSettings()
  38. {
  39. $blockService = new FakeBlockService('foo', $this->templating, $this->pool);
  40. $blockContext = $this->getBlockContext($blockService);
  41. $this->assertSettings(array(
  42. 'foo' => 'bar',
  43. 'groups' => true,
  44. ), $blockContext);
  45. }
  46. }