Skip to content

Commit

Permalink
Merge branch '1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
alongosz committed Sep 30, 2019
2 parents c046aa3 + 02ee7ae commit 667a9b1
Show file tree
Hide file tree
Showing 9 changed files with 156 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/vendor/
/composer.lock
.php_cs.cache
.phpunit.result.cache
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ matrix:
php: '7.3'
script:
- composer fix-cs
- name: 'Unit tests'
php: '7.3'
script:
- composer test

notifications:
slack:
Expand Down
11 changes: 10 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,29 @@
],
"autoload": {
"psr-4": {
"EzSystems\\EzPlatformCoreBundle\\": "src/EzPlatformCoreBundle/bundle/",
"EzSystems\\EzPlatformEncoreBundle\\": "src/EzPlatformEncoreBundle/bundle/"
}
},
"autoload-dev": {
"psr-4": {
"EzSystems\\Tests\\EzPlatformCoreBundle\\": "tests/EzPlatformCoreBundle/bundle/"
}
},
"require": {
"php": "^7.3",
"symfony/config": "^4.3",
"symfony/dependency-injection": "^4.3",
"symfony/filesystem": "^4.3",
"symfony/finder": "^4.3",
"symfony/http-kernel": "^4.3"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.15"
"friendsofphp/php-cs-fixer": "^2.15",
"phpunit/phpunit": "^8.3.5"
},
"scripts": {
"test": "phpunit -v -c phpunit.xml",
"fix-cs": "@php ./vendor/bin/php-cs-fixer fix -v --show-progress=estimating"
},
"extra": {
Expand Down
16 changes: 16 additions & 0 deletions phpunit.xml
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>
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;
}
}
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);
}
}
}
21 changes: 21 additions & 0 deletions src/EzPlatformCoreBundle/bundle/EzPlatformCoreBundle.php
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 removed tests/.gitkeep
Empty file.
22 changes: 22 additions & 0 deletions tests/EzPlatformCoreBundle/bundle/EzPlatformCoreBundleTest.php
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());
}
}

0 comments on commit 667a9b1

Please sign in to comment.