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

Add more tests #1537

Merged
merged 2 commits into from Aug 10, 2022
Merged

Conversation

jordisala1991
Copy link
Member

@jordisala1991 jordisala1991 commented Aug 10, 2022

Subject

I am targeting this branch, because this is fixing bugs present only on 4.x.

2 Commits again:

  • First adding tests that are completely broken
  • Fixing tests

@@ -98,6 +98,10 @@ protected function configureRoutes(RouteCollectionInterface $collection): void
$collection->add('composePreview', '{block_id}/compose_preview', [
'block_id' => null,
]);

if (!$this->isChild()) {
$collection->remove('create');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like a BlockAdmin can't be created unless is child of page or is a sharedBlock (another admin)

$form->add('enabled', HiddenType::class, ['data' => true]);
} else {
$form->add('enabled');
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double added enabled (was added by the configureBlockFields above), it was also added in another block, and sonata complains about double property enabled.

@@ -86,8 +86,7 @@ public function createAction(Request $request): Response
{
$this->admin->checkAccess('create');

$sharedBlockAdminClass = $this->getParameter('sonata.page.admin.shared_block.class');
if (!$this->admin->isChild() && \get_class($this->admin) !== $sharedBlockAdminClass) {
if (!$this->admin->isChild()) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was a weird hack to avoid creating a block outside child or shared admin, was better solved with the other solution

@@ -162,6 +161,7 @@ public function composePreviewAction(Request $request): Response
'container' => $container,
'child' => $block,
'blockServices' => $blockServices,
'blockAdmin' => $this->admin,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix missing variable previously changed on my other PR.

@@ -58,6 +58,7 @@
'controller' => 'sonata.page.controller.admin.block',
'manager_type' => 'orm',
'show_in_dashboard' => false,
'default' => true,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are 2 admins for same class, I made blockadmin the default one.

@@ -14,7 +14,7 @@
{% set metadata = service.blockMetadata %}
{% endif %}
<h4 class="page-composer__container__child__name">
{{ child.name|default(service.name)|trans({}, service.blockMetadata.domain|default('SonataPageBundle')) }}
{{ child.name|default(metadata.title)|trans({}, metadata.domain|default('SonataPageBundle')) }}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

completely broken too.

@jordisala1991 jordisala1991 marked this pull request as ready for review August 10, 2022 11:36
@VincentLanglet VincentLanglet merged commit 1fe85dc into sonata-project:4.x Aug 10, 2022
@VincentLanglet
Copy link
Member

Can you update #1495 (comment) if you fixed some

@jordisala1991 jordisala1991 deleted the hotfix/more-tests-2 branch August 10, 2022 12:16
@jordisala1991
Copy link
Member Author

I think I fixed other issues that are not detected yet 😓

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants