1 | <?php |
||
27 | class AuditBlockServiceTest extends AbstractBlockServiceTestCase |
||
28 | { |
||
29 | private $simpleThingsAuditReader; |
||
30 | private $blockService; |
||
31 | |||
32 | protected function setUp(): void |
||
33 | { |
||
34 | parent::setUp(); |
||
35 | $this->simpleThingsAuditReader = $this->prophesize(SimpleThingsAuditReader::class); |
||
36 | |||
37 | $this->blockService = new AuditBlockService( |
||
38 | 'block.service', |
||
39 | $this->templating, |
||
40 | $this->simpleThingsAuditReader->reveal() |
||
41 | ); |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * @group legacy |
||
46 | */ |
||
47 | public function testExecute(): void |
||
48 | { |
||
49 | $blockContext = $this->prophesize(BlockContext::class); |
||
50 | |||
51 | $blockContext->getBlock()->willReturn($block = new Block())->shouldBeCalledTimes(1); |
||
52 | $blockContext->getSetting('limit')->willReturn($limit = 10)->shouldBeCalledTimes(1); |
||
53 | |||
54 | $this->simpleThingsAuditReader->findRevisionHistory($limit, 0) |
||
55 | ->willReturn([$revision = new Revision('test', '123', 'test')]) |
||
56 | ->shouldBeCalledTimes(1); |
||
57 | |||
58 | $this->simpleThingsAuditReader->findEntitesChangedAtRevision(Argument::cetera()) |
||
59 | ->willReturn([]) |
||
60 | ->shouldBeCalledTimes(1); |
||
61 | |||
62 | $blockContext->getTemplate()->willReturn('template')->shouldBeCalledTimes(1); |
||
63 | $blockContext->getSettings()->willReturn([])->shouldBeCalledTimes(1); |
||
64 | |||
65 | $this->blockService->execute($blockContext->reveal()); |
||
66 | |||
67 | $this->assertSame('template', $this->templating->view); |
||
68 | $this->assertInternalType('array', $this->templating->parameters['settings']); |
||
69 | $this->assertSame($revision, $this->templating->parameters['revisions'][0]['revision']); |
||
70 | $this->assertSame($block, $this->templating->parameters['block']); |
||
71 | } |
||
72 | |||
73 | public function testDefaultSettings(): void |
||
86 | } |
||
87 |