forked from Sylius/Sylius
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MoneyBundle] Services initialization test
- Loading branch information
Magdalena Banasiak
committed
Nov 29, 2016
1 parent
f0fb82b
commit 03fc42e
Showing
9 changed files
with
226 additions
and
2 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -3,3 +3,6 @@ bin/ | |
|
||
composer.phar | ||
composer.lock | ||
|
||
test/app/cache | ||
test/app/logs |
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,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd" | ||
backupGlobals="false" | ||
colors="true" | ||
bootstrap="test/app/autoload.php" | ||
> | ||
<php> | ||
<server name="KERNEL_DIR" value="test/app/" /> | ||
<server name="IS_DOCTRINE_ORM_SUPPORTED" value="true" /> | ||
</php> | ||
<testsuites> | ||
<testsuite name="SyliusMoneyBundle Test Suite"> | ||
<directory>./test/</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
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,59 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
use PSS\SymfonyMockerContainer\DependencyInjection\MockerContainer; | ||
use Symfony\Component\Config\Loader\LoaderInterface; | ||
use Symfony\Component\HttpKernel\Kernel; | ||
|
||
/** | ||
* @author Magdalena Banasiak <[email protected]> | ||
*/ | ||
class AppKernel extends Kernel | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function registerBundles() | ||
{ | ||
return [ | ||
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), | ||
new winzou\Bundle\StateMachineBundle\winzouStateMachineBundle(), | ||
new FOS\RestBundle\FOSRestBundle(), | ||
new JMS\SerializerBundle\JMSSerializerBundle($this), | ||
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(), | ||
new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(), | ||
new Sylius\Bundle\MoneyBundle\SyliusMoneyBundle(), | ||
new Sylius\Bundle\ResourceBundle\SyliusResourceBundle(), | ||
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), | ||
new Symfony\Bundle\TwigBundle\TwigBundle(), | ||
]; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function registerContainerConfiguration(LoaderInterface $loader) | ||
{ | ||
$loader->load(__DIR__.'/config/config.yml'); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function getContainerBaseClass() | ||
{ | ||
if ('test' === $this->environment) { | ||
return MockerContainer::class; | ||
} | ||
|
||
return parent::getContainerBaseClass(); | ||
} | ||
} |
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,20 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
use Doctrine\Common\Annotations\AnnotationRegistry; | ||
|
||
$loader = require __DIR__.'/../../vendor/autoload.php'; | ||
|
||
require __DIR__.'/AppKernel.php'; | ||
|
||
AnnotationRegistry::registerLoader([$loader, 'loadClass']); | ||
|
||
return $loader; |
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,43 @@ | ||
imports: | ||
- { resource: "@SyliusMoneyBundle/test/app/config/parameters.yml" } | ||
|
||
framework: | ||
assets: false | ||
translator: { fallbacks: ["%locale%"] } | ||
secret: "%secret%" | ||
router: | ||
resource: "%kernel.root_dir%/config/routing.yml" | ||
form: ~ | ||
csrf_protection: true | ||
templating: | ||
engines: ['twig'] | ||
default_locale: "%locale%" | ||
session: | ||
handler_id: ~ | ||
http_method_override: true | ||
test: ~ | ||
session: | ||
storage_id: session.storage.mock_file | ||
|
||
twig: | ||
debug: "%kernel.debug%" | ||
strict_variables: "%kernel.debug%" | ||
|
||
doctrine: | ||
dbal: | ||
driver: "%database_driver%" | ||
path: "%database_path%" | ||
charset: UTF8 | ||
orm: | ||
entity_managers: | ||
default: | ||
auto_mapping: true | ||
|
||
fos_rest: | ||
view: | ||
formats: | ||
json: true | ||
empty_content: 204 | ||
format_listener: | ||
rules: | ||
- { path: '^/', priorities: ['json'], fallback_format: json, prefer_extension: true } |
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,6 @@ | ||
parameters: | ||
database_driver: pdo_sqlite | ||
database_path: "%kernel.root_dir%/db.sql" | ||
|
||
locale: en_US | ||
secret: "Three can keep a secret, if two of them are dead." |
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,24 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
set_time_limit(0); | ||
|
||
require_once __DIR__ . "/../../vendor/autoload.php"; | ||
require_once __DIR__.'/AppKernel.php'; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Console\Application; | ||
use Symfony\Component\Console\Input\ArgvInput; | ||
|
||
$input = new ArgvInput(); | ||
|
||
$application = new Application(new AppKernel('test', true)); | ||
$application->run($input); |
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,40 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Sylius\Bundle\MoneyBundle\Tests; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | ||
use Symfony\Component\DependencyInjection\ContainerInterface; | ||
|
||
/** | ||
* @author Magdalena Banasiak <[email protected]> | ||
*/ | ||
class SyliusMoneyBundleTest extends WebTestCase | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function its_services_are_intitializable() | ||
{ | ||
/** @var ContainerInterface $container */ | ||
$container = self::createClient()->getContainer(); | ||
|
||
$services = $container->getServiceIds(); | ||
|
||
$services = array_filter($services, function ($serviceId) { | ||
return false !== strpos($serviceId, 'sylius'); | ||
}); | ||
|
||
foreach ($services as $id) { | ||
$container->get($id); | ||
} | ||
} | ||
} |