Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deleted blocks (from composer) still visible #1293

Merged
merged 1 commit into from Apr 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Admin/Extension/CreateSnapshotAdminExtension.php
Expand Up @@ -41,6 +41,11 @@ public function postPersist(AdminInterface $admin, $object)
$this->sendMessage($object);
}

public function postRemove(AdminInterface $admin, $object)
{
$this->sendMessage($object);
}

/**
* @param PageInterface $object
*/
Expand Down
20 changes: 20 additions & 0 deletions tests/Admin/Extension/CreateSnapshotAdminExtensionTest.php
Expand Up @@ -95,4 +95,24 @@ public function testPostPersistOnBlock(): void
$extension = new CreateSnapshotAdminExtension($backend);
$extension->postPersist($admin, $block);
}

public function testPostRemoveOnBlock(): void
{
$page = $this->createMock(PageInterface::class);
$page->expects($this->once())->method('getId')->willReturn(42);

$block = $this->createMock(PageBlockInterface::class);
$block->expects($this->once())->method('getPage')->willReturn($page);

$admin = $this->createStub(AdminInterface::class);

$backend = $this->createMock(BackendInterface::class);
$backend->expects($this->once())->method('createAndPublish')->with(
'sonata.page.create_snapshot',
['pageId' => 42]
);

$extension = new CreateSnapshotAdminExtension($backend);
$extension->postRemove($admin, $block);
}
}