Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/Eccube/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,16 @@ public function registerBundles(): iterable
}
}
}

$customizeBundles = $this->getProjectDir().'/app/Customize/Resource/config/bundles.php';
if (file_exists($customizeBundles)) {
$contents = require $customizeBundles;
foreach ($contents as $class => $envs) {
if (isset($envs['all']) || isset($envs[$this->environment])) {
yield new $class();
}
}
}
}

/**
Expand Down
57 changes: 57 additions & 0 deletions tests/Eccube/Tests/CustomizeBundleTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php

/*
* This file is part of EC-CUBE
*
* Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
*
* http://www.ec-cube.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Eccube\Tests;

use Customize\Bundle\CustomizeBundle;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Filesystem\Filesystem;

class CustomizeBundleTest extends KernelTestCase
{
public function tearDown(): void
{
$fs = new Filesystem();
$fs->remove(__DIR__.'/../../../app/Customize/Bundle');
$fs->remove(__DIR__.'/../../../app/Customize/Resource/config/bundles.php');

parent::tearDown();
}

public function testContainsCustomizeBundle()
{
$fs = new Filesystem();
$originDir = __DIR__.'/../../Fixtures/Customize';
$targetDir = __DIR__.'/../../../app/Customize';
$fs->mirror($originDir, $targetDir);

$kernel = static::bootKernel();
$bundleNames = [];
foreach ($kernel->getBundles() as $bundle) {
$bundleNames[] = get_class($bundle);
}

self::assertContains(CustomizeBundle::class, $bundleNames);
}

public function testNotContainsCustomizeBundle()
{
$kernel = static::bootKernel();
$bundleNames = [];
foreach ($kernel->getBundles() as $bundle) {
$bundleNames[] = get_class($bundle);
}

self::assertNotContains(CustomizeBundle::class, $bundleNames);
}
}
21 changes: 21 additions & 0 deletions tests/Fixtures/Customize/Bundle/CustomizeBundle.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

/*
* This file is part of EC-CUBE
*
* Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
*
* http://www.ec-cube.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Customize\Bundle;

use Customize\DependencyInjection\CustomizeExtension;
use Symfony\Component\HttpKernel\Bundle\Bundle;

class CustomizeBundle extends Bundle
{
}
16 changes: 16 additions & 0 deletions tests/Fixtures/Customize/Resource/config/bundles.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

/*
* This file is part of EC-CUBE
*
* Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
*
* http://www.ec-cube.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

return [
Customize\Bundle\CustomizeBundle::class => ['all' => true],
];