Skip to content

Commit

Permalink
Add support for Symfony 5
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexMasterov committed Dec 27, 2019
1 parent 20a0dca commit 5d53139
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
5 changes: 3 additions & 2 deletions README.md
@@ -1,7 +1,6 @@
## PsyshBundle

[![Latest Stable Version](https://poser.pugx.org/alexmasterov/psysh-bundle/v/stable)](https://packagist.org/packages/alexmasterov/psysh-bundle)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/AlexMasterov/psysh-bundle/master/LICENSE)
[![Build Status](https://travis-ci.org/AlexMasterov/psysh-bundle.svg)](https://travis-ci.org/AlexMasterov/psysh-bundle)
[![Code Coverage](https://scrutinizer-ci.com/g/AlexMasterov/psysh-bundle/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/AlexMasterov/psysh-bundle/?branch=master)
[![Code Quality](https://scrutinizer-ci.com/g/AlexMasterov/psysh-bundle/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/AlexMasterov/psysh-bundle/?branch=master)
Expand Down Expand Up @@ -54,7 +53,6 @@ $ php bin/console psysh:shell
>>> ls
Variables: $someController, $mail, $someService, $db
```
_WIP_...

## Configuration
Some common options. For a more detailed list, see [wiki](https://github.com/bobthecow/psysh/wiki/Config-options).
Expand All @@ -80,3 +78,6 @@ Some common options. For a more detailed list, see [wiki](https://github.com/bob
| `use_tab_completion` | `bool` |
| `matchers` | `array` [`string`] |
| `variables` | `array` [`string`] |

## License
[MIT](LICENSE)
12 changes: 6 additions & 6 deletions composer.json
Expand Up @@ -9,9 +9,9 @@
"email": "alex.masterow@gmail.com"
}],
"keywords": [
"psysh",
"symfony",
"bundle"
"bundle",
"psysh"
],
"config": {
"preferred-install": {
Expand All @@ -38,11 +38,11 @@
"require": {
"php": "^7.1.0",
"psy/psysh": "^0.9",
"symfony/config": "^4.0",
"symfony/dependency-injection": "^4.0",
"symfony/http-kernel": "^4.0"
"symfony/config": "^4.0|^5.0",
"symfony/dependency-injection": "^4.0|^5.0",
"symfony/http-kernel": "^4.0|^5.0"
},
"require-dev": {
"phpunit/phpunit": "^7.1"
"phpunit/phpunit": "^8.5.1"
}
}
4 changes: 2 additions & 2 deletions src/DependencyInjection/Configuration.php
Expand Up @@ -26,8 +26,8 @@ class Configuration implements ConfigurationInterface
/** {@inheritdoc} */
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('psysh');
$treeBuilder = new TreeBuilder('psysh');
$rootNode = $treeBuilder->getRootNode();

$rootNode
->children()
Expand Down
17 changes: 11 additions & 6 deletions tests/DependencyInjection/ExtensionTest.php
Expand Up @@ -17,6 +17,8 @@ final class ExtensionTest extends TestCase
/** @test */
public function it_valid_register(): void
{
static $SERVICE_NAME = 'psysh.shell';

// Stub
$config = [
'variables' => [
Expand All @@ -34,12 +36,15 @@ public function it_valid_register(): void
$container = $this->loadExtension($config);

// Verify
self::assertTrue($container->has('psysh.shell'));
self::assertInstanceOf(Shell::class, $container->get('psysh.shell'));
self::assertArraySubset(
array_keys($config['variables']),
$container->get('psysh.shell')->getScopeVariableNames()
);
self::assertTrue($container->has($SERVICE_NAME));

$shell = $container->get($SERVICE_NAME);
self::assertInstanceOf(Shell::class, $shell);

$scopeVariables = $shell->getScopeVariableNames();
foreach (array_keys($config['variables']) as $variable) {
self::assertContains($variable, $scopeVariables);
}
}

private function loadExtension(array $config = [], ContainerBuilder $container = null): ContainerBuilder
Expand Down

0 comments on commit 5d53139

Please sign in to comment.