-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
156 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/vendor/ | ||
/composer.lock | ||
.php_cs.cache | ||
.phpunit.result.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<phpunit | ||
backupGlobals="false" | ||
backupStaticAttributes="false" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
beStrictAboutTestsThatDoNotTestAnything="true" | ||
colors="true" | ||
> | ||
<php> | ||
<ini name="error_reporting" value="-1" /> | ||
</php> | ||
<testsuite name="EzPlatformCoreBundle"> | ||
<directory>tests/EzPlatformCoreBundle/bundle</directory> | ||
</testsuite> | ||
</phpunit> |
32 changes: 32 additions & 0 deletions
32
src/EzPlatformCoreBundle/bundle/DependencyInjection/Configuration.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace EzSystems\EzPlatformCoreBundle\DependencyInjection; | ||
|
||
use Symfony\Component\Config\Definition\Builder\TreeBuilder; | ||
use Symfony\Component\Config\Definition\ConfigurationInterface; | ||
|
||
final class Configuration implements ConfigurationInterface | ||
{ | ||
/** | ||
* Generates the configuration tree builder. | ||
* | ||
* @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder | ||
*/ | ||
public function getConfigTreeBuilder(): TreeBuilder | ||
{ | ||
$treeBuilder = new TreeBuilder(EzPlatformCoreExtension::EXTENSION_ALIAS); | ||
|
||
$rootNode = $treeBuilder->getRootNode(); | ||
|
||
// @todo define actual configuration (move from EzPublishCoreBundle) | ||
$rootNode->variablePrototype(); | ||
|
||
return $treeBuilder; | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
src/EzPlatformCoreBundle/bundle/DependencyInjection/EzPlatformCoreExtension.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace EzSystems\EzPlatformCoreBundle\DependencyInjection; | ||
|
||
use Symfony\Component\Config\Definition\ConfigurationInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Extension\Extension; | ||
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; | ||
|
||
final class EzPlatformCoreExtension extends Extension implements PrependExtensionInterface | ||
{ | ||
public const EXTENSION_ALIAS = 'ezplatform'; | ||
|
||
public function load(array $configs, ContainerBuilder $container): void | ||
{ | ||
} | ||
|
||
public function getConfiguration( | ||
array $config, | ||
ContainerBuilder $container | ||
): ConfigurationInterface { | ||
return new Configuration(); | ||
} | ||
|
||
public function getAlias(): string | ||
{ | ||
return self::EXTENSION_ALIAS; | ||
} | ||
|
||
/** | ||
* Prepend "ezplatform" configuration to "ezpublish" configuration. | ||
* | ||
* @todo remove once we replace EzPublishCoreBundle with EzPlatformCoreBundle | ||
*/ | ||
public function prepend(ContainerBuilder $container): void | ||
{ | ||
// inject "ezplatform" extension settings into "ezpublish" extension | ||
// configuration here is zero-based array of configurations from multiple sources | ||
// to be merged by "ezpublish" extension | ||
foreach ($container->getExtensionConfig('ezplatform') as $eZPlatformConfig) { | ||
$container->prependExtensionConfig('ezpublish', $eZPlatformConfig); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace EzSystems\EzPlatformCoreBundle; | ||
|
||
use EzSystems\EzPlatformCoreBundle\DependencyInjection\EzPlatformCoreExtension; | ||
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; | ||
use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
|
||
final class EzPlatformCoreBundle extends Bundle | ||
{ | ||
public function getContainerExtension(): ExtensionInterface | ||
{ | ||
return new EzPlatformCoreExtension(); | ||
} | ||
} |
Empty file.
22 changes: 22 additions & 0 deletions
22
tests/EzPlatformCoreBundle/bundle/EzPlatformCoreBundleTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace EzSystems\Tests\EzPlatformCoreBundle; | ||
|
||
use EzSystems\EzPlatformCoreBundle\EzPlatformCoreBundle; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class EzPlatformCoreBundleTest extends TestCase | ||
{ | ||
public function testInstantiateBundle(): void | ||
{ | ||
$bundle = new EzPlatformCoreBundle(); | ||
self::assertEquals('EzPlatformCoreBundle', $bundle->getName()); | ||
self::assertEquals('ezplatform', $bundle->getContainerExtension()->getAlias()); | ||
} | ||
} |