From 389e416c1a2d79efad6edb3f86358f16ab729e97 Mon Sep 17 00:00:00 2001 From: Javier Spagnoletti Date: Thu, 27 Aug 2020 19:41:05 -0300 Subject: [PATCH] Fix block related tests --- tests/Block/AuditBlockServiceTest.php | 4 ++-- tests/Block/DeprecatedAuditBlockServiceTest.php | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/Block/AuditBlockServiceTest.php b/tests/Block/AuditBlockServiceTest.php index 3132c8d7c..aff7a5344 100644 --- a/tests/Block/AuditBlockServiceTest.php +++ b/tests/Block/AuditBlockServiceTest.php @@ -16,7 +16,7 @@ use PHPUnit\Framework\MockObject\MockObject; use SimpleThings\EntityAudit\AuditReader as SimpleThingsAuditReader; use SimpleThings\EntityAudit\Revision; -use Sonata\BlockBundle\Block\BlockContext; +use Sonata\BlockBundle\Block\BlockContextInterface; use Sonata\BlockBundle\Model\Block; use Sonata\BlockBundle\Test\BlockServiceTestCase; use Sonata\DoctrineORMAdminBundle\Block\AuditBlockService; @@ -52,7 +52,7 @@ protected function setUp(): void */ public function testExecute(): void { - $blockContext = $this->createMock(BlockContext::class); + $blockContext = $this->createMock(BlockContextInterface::class); $blockContext->expects($this->once())->method('getBlock')->willReturn($block = new Block()); $blockContext->expects($this->once())->method('getSetting')->with('limit')->willReturn($limit = 10); diff --git a/tests/Block/DeprecatedAuditBlockServiceTest.php b/tests/Block/DeprecatedAuditBlockServiceTest.php index 5f7bf8766..ac4b46f8b 100644 --- a/tests/Block/DeprecatedAuditBlockServiceTest.php +++ b/tests/Block/DeprecatedAuditBlockServiceTest.php @@ -16,7 +16,7 @@ use Prophecy\Argument; use SimpleThings\EntityAudit\AuditReader as SimpleThingsAuditReader; use SimpleThings\EntityAudit\Revision; -use Sonata\BlockBundle\Block\BlockContext; +use Sonata\BlockBundle\Block\BlockContextInterface; use Sonata\BlockBundle\Model\Block; use Sonata\BlockBundle\Test\BlockServiceTestCase; use Sonata\DoctrineORMAdminBundle\Block\AuditBlockService; @@ -35,6 +35,13 @@ class DeprecatedAuditBlockServiceTest extends BlockServiceTestCase protected function setUp(): void { + if (!property_exists($this, 'templating')) { + $this->markTestSkipped(sprintf( + '%s requires sonata-project/block-bundle < 3.18.4.', + __CLASS__ + )); + } + parent::setUp(); $this->simpleThingsAuditReader = $this->prophesize(SimpleThingsAuditReader::class); @@ -50,7 +57,7 @@ protected function setUp(): void */ public function testExecute(): void { - $blockContext = $this->prophesize(BlockContext::class); + $blockContext = $this->prophesize(BlockContextInterface::class); $blockContext->getBlock()->willReturn($block = new Block())->shouldBeCalledTimes(1); $blockContext->getSetting('limit')->willReturn($limit = 10)->shouldBeCalledTimes(1);