Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 80c8033

Browse files
committed
extension factory test for block
1 parent 83a1931 commit 80c8033

File tree

2 files changed

+96
-26
lines changed

2 files changed

+96
-26
lines changed

tests/Unit/DependencyInjection/CmfSonataAdminExtensionTest.php

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -45,32 +45,6 @@ public function testThatBundlesAreConfigured()
4545
$this->load([]);
4646
}
4747

48-
public function testBlockBundle()
49-
{
50-
$this->container->setParameter(
51-
'kernel.bundles',
52-
[
53-
'CmfBlockBundle' => true,
54-
'CmfMenuBundle' => true,
55-
'CmfRoutingBundle' => true,
56-
'SonataDoctrinePHPCRAdminBundle' => true,
57-
'DoctrinePHPCRBundle' => true,
58-
]
59-
);
60-
61-
$this->load([
62-
'bundles' => [
63-
'block' => [
64-
'enabled' => true,
65-
'basepath' => 'basepath_value',
66-
'menu_basepath' => 'menu_basepath_value',
67-
],
68-
],
69-
]);
70-
71-
$this->assertContainerBuilderHasParameter('cmf_sonata_phpcr_admin_integration.block.persistence.basepath', 'basepath_value');
72-
$this->assertContainerBuilderHasParameter('cmf_sonata_phpcr_admin_integration.block.persistence.menu_basepath', 'menu_basepath_value');
73-
}
7448

7549
public function testCoreDefaults()
7650
{
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<?php
2+
3+
namespace Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Tests\Unit\DependencyInjection\Factory;
4+
5+
/**
6+
* @author Maximilian Berghoff <[email protected]>
7+
*/
8+
class BlockAdminFactoryTest extends AbstractFactoryTest
9+
{
10+
public function testParametersBundle()
11+
{
12+
$this->container->setParameter(
13+
'kernel.bundles',
14+
[
15+
'CmfBlockBundle' => true,
16+
'CmfMenuBundle' => true,
17+
'CmfRoutingBundle' => true,
18+
'SonataDoctrinePHPCRAdminBundle' => true,
19+
'DoctrinePHPCRBundle' => true,
20+
]
21+
);
22+
23+
$this->load([
24+
'bundles' => [
25+
'block' => [
26+
'enabled' => true,
27+
'use_imagine' => true,
28+
'basepath' => 'basepath_value',
29+
'menu_basepath' => 'menu_basepath_value',
30+
'extensions' => [
31+
'block_cache' => [
32+
'form_group' => 'block_group',
33+
'form_tab' => 'block_tab',
34+
],
35+
],
36+
],
37+
],
38+
]);
39+
40+
$this->assertContainerBuilderHasParameter('cmf_sonata_phpcr_admin_integration.block.persistence.basepath', 'basepath_value');
41+
$this->assertContainerBuilderHasParameter('cmf_sonata_phpcr_admin_integration.block.persistence.menu_basepath', 'menu_basepath_value');
42+
$this->assertContainerBuilderHasParameter('cmf_sonata_phpcr_admin_integration.block.extension.block_cache.form_group', 'block_group');
43+
$this->assertContainerBuilderHasParameter('cmf_sonata_phpcr_admin_integration.block.extension.block_cache.form_tab', 'block_tab');
44+
}
45+
46+
public function testAdminServicesBundle()
47+
{
48+
$this->container->setParameter(
49+
'kernel.bundles',
50+
[
51+
'CmfBlockBundle' => true,
52+
'CmfRoutingBundle' => true,
53+
'SonataDoctrinePHPCRAdminBundle' => true,
54+
'DoctrinePHPCRBundle' => true,
55+
]
56+
);
57+
58+
$this->load([
59+
'bundles' => [
60+
'block' => true,
61+
],
62+
]);
63+
64+
$this->assertContainerBuilderHasService('cmf_sonata_phpcr_admin_integration.block.admin_extension.cache');
65+
$this->assertContainerBuilderHasService('cmf_sonata_phpcr_admin_integration.block.simple_admin');
66+
$this->assertContainerBuilderHasService('cmf_sonata_phpcr_admin_integration.block.action_admin');
67+
$this->assertContainerBuilderHasService('cmf_sonata_phpcr_admin_integration.block.container_admin');
68+
$this->assertContainerBuilderHasService('cmf_sonata_phpcr_admin_integration.block.reference_admin');
69+
$this->assertContainerBuilderHasService('cmf_sonata_phpcr_admin_integration.block.string_admin');
70+
}
71+
72+
public function testMenuAdminServicesBundle()
73+
{
74+
$this->container->setParameter(
75+
'kernel.bundles',
76+
[
77+
'CmfBlockBundle' => true,
78+
'CmfMenuBundle' => true,
79+
'CmfRoutingBundle' => true,
80+
'SonataDoctrinePHPCRAdminBundle' => true,
81+
'DoctrinePHPCRBundle' => true,
82+
]
83+
);
84+
85+
$this->load([
86+
'bundles' => [
87+
'block' => [
88+
'enabled' => true,
89+
'enable_menu' => 'auto'
90+
]
91+
],
92+
]);
93+
94+
$this->assertContainerBuilderHasService('cmf_sonata_phpcr_admin_integration.block.menu_admin');
95+
}
96+
}

0 commit comments

Comments
 (0)