-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
80d5799
commit 5a89e88
Showing
9 changed files
with
120 additions
and
13 deletions.
There are no files selected for viewing
File renamed without changes.
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,7 @@ | ||
test: | ||
bin/phpspec run -fpretty | ||
bin/symfony-integration-checker check -vvv | ||
bin/php-cs-fixer --diff --dry-run -v fix | ||
|
||
fix: | ||
bin/php-cs-fixer fix -vvv |
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,74 @@ | ||
#SYMFONY Integration Checker | ||
============================ | ||
|
||
## Installation | ||
|
||
```bash | ||
$ composer require pedrotroller/symfony-integration-checker --dev ~1.0.0 | ||
``` | ||
|
||
## Usage | ||
|
||
You just have to create a `.symfony_checker`. This script should return a callback. This callback will have an instance of `PedroTroller\Symfony\IntegrationChecker\ConfigurableKernel` as parameter. | ||
|
||
```php | ||
use PedroTroller\Symfony\IntegrationChecker\ConfigurableKernel; | ||
|
||
return function (ConfigurableKernel $kernel) { | ||
// Your configuration | ||
}; | ||
``` | ||
|
||
## Launch the checker | ||
|
||
```bash | ||
$ ./bin/symfony-integration-checker check | ||
``` | ||
|
||
## Available kernel customization | ||
|
||
`$kernel->addBundle(BundleInterface $bundle)`: you can dynamically inject bundles into your kernel. | ||
|
||
`$kernel->setConfig(array $config)`: inject a configuration. | ||
|
||
`$kernel->setContainerBuilder(ContainerBuilder $container)`: inject your own container. | ||
|
||
`$kernel->afterBoot(callable $callable)`: inject a callable. This callable will be executed after the kernel boot. | ||
|
||
## Example | ||
|
||
```php | ||
<?php | ||
|
||
use PedroTroller\Symfony\IntegrationChecker\ConfigurableKernel; | ||
use Symfony\Bundle\FrameworkBundle\FrameworkBundle; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\HttpKernel\KernelInterface; | ||
use Symfony\Component\Translation\TranslatorInterface; | ||
|
||
$config = array( | ||
'framework' => array( | ||
'translator' => array( | ||
'enabled' => true, | ||
), | ||
), | ||
); | ||
|
||
$test = function (KernelInterface $kernel) { | ||
if (false === $kernel->getContainer()->get('translator') instanceof TranslatorInterface) { | ||
throw new \Exception('Oups, there is a problem !'); | ||
} | ||
}; | ||
|
||
return function (ConfigurableKernel $kernel) use ($config, $test) { | ||
$container = new ContainerBuilder(); | ||
$container->setParameter('kernel.secret', md5(time())); | ||
|
||
$kernel | ||
->setContainerBuilder($container) | ||
->setConfig($config) | ||
->addBundle(new FrameworkBundle()) | ||
->afterBoot($test) | ||
; | ||
}; | ||
``` |
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
4 changes: 2 additions & 2 deletions
4
...ymfony/IntegrationChecker/Application.php → ...ymfony/IntegrationChecker/Application.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
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