Skip to content

Commit 9964f8b

Browse files
gremofranmomu
authored andcommittedApr 18, 2021
Fix deleted blocks (from composer) still visible
1 parent 9167dd5 commit 9964f8b

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
 

‎src/Admin/Extension/CreateSnapshotAdminExtension.php

+5
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ public function postPersist(AdminInterface $admin, $object)
4141
$this->sendMessage($object);
4242
}
4343

44+
public function postRemove(AdminInterface $admin, $object)
45+
{
46+
$this->sendMessage($object);
47+
}
48+
4449
/**
4550
* @param PageInterface $object
4651
*/

‎tests/Admin/Extension/CreateSnapshotAdminExtensionTest.php

+20
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,24 @@ public function testPostPersistOnBlock(): void
9595
$extension = new CreateSnapshotAdminExtension($backend);
9696
$extension->postPersist($admin, $block);
9797
}
98+
99+
public function testPostRemoveOnBlock(): void
100+
{
101+
$page = $this->createMock(PageInterface::class);
102+
$page->expects($this->once())->method('getId')->willReturn(42);
103+
104+
$block = $this->createMock(PageBlockInterface::class);
105+
$block->expects($this->once())->method('getPage')->willReturn($page);
106+
107+
$admin = $this->createStub(AdminInterface::class);
108+
109+
$backend = $this->createMock(BackendInterface::class);
110+
$backend->expects($this->once())->method('createAndPublish')->with(
111+
'sonata.page.create_snapshot',
112+
['pageId' => 42]
113+
);
114+
115+
$extension = new CreateSnapshotAdminExtension($backend);
116+
$extension->postRemove($admin, $block);
117+
}
98118
}

0 commit comments

Comments
 (0)