This repository has been archived by the owner on Jun 23, 2024. It is now read-only.
forked from navitronic/psymf
-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the test.xml of the FrameworkBundle
- Loading branch information
Maxime Helias
committed
Oct 2, 2019
1 parent
6cbd194
commit 5617830
Showing
3 changed files
with
11 additions
and
47 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
use Psy\Command\Command; | ||
use Symfony\Component\Config\FileLocator; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; | ||
use Symfony\Component\DependencyInjection\Loader; | ||
use Symfony\Component\DependencyInjection\Reference; | ||
use Symfony\Component\ExpressionLanguage\Expression; | ||
|
@@ -27,18 +28,22 @@ | |
* | ||
* @author Théo FIDRY <[email protected]> | ||
*/ | ||
final class PsyshExtension extends Extension | ||
final class PsyshExtension extends Extension implements PrependExtensionInterface | ||
{ | ||
public function prepend(ContainerBuilder $container) | ||
{ | ||
if (class_exists(TestContainer::class)) { | ||
$container->prependExtensionConfig('framework', ['test' => true]); | ||
} | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function load(array $configs, ContainerBuilder $container) | ||
{ | ||
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../../resources/config')); | ||
$loader->load('services.xml'); | ||
if (class_exists(TestContainer::class) && !$container->has('test.service_container')) { | ||
$loader->load('test.xml'); | ||
} | ||
|
||
$configuration = new Configuration(); | ||
$config = $this->processConfiguration($configuration, $configs); | ||
|
@@ -47,7 +52,7 @@ public function load(array $configs, ContainerBuilder $container) | |
$value = new Reference(substr($value, 1)); | ||
} | ||
} | ||
$containerId = $container->has('test.service_container') ? 'test.service_container' : 'service_container'; | ||
$containerId = class_exists(TestContainer::class) ? 'test.service_container' : 'service_container'; | ||
$container->findDefinition('psysh.shell') | ||
->addMethodCall('setScopeVariables', [$config['variables'] + [ | ||
'container' => new Reference($containerId), | ||
|
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