Skip to content

Commit

Permalink
Merge pull request #26 from broadway/functional-test
Browse files Browse the repository at this point in the history
functional test
  • Loading branch information
asm89 authored Mar 7, 2017
2 parents 79e9118 + 7c5d874 commit a98f317
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 24 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/vendor/
composer.lock
test/Functional/cache
test/Functional/logs
9 changes: 6 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,15 @@
"require-dev": {
"broadway/event-store-dbal": "^0.1",
"elasticsearch/elasticsearch": "~1.0|^2.0",
"instaclick/base-test-bundle": "~0.5",
"symfony/framework-bundle": "^2.3|^3.0",
"monolog/monolog": "~1.8",
"symfony/proxy-manager-bridge": "~2.4",
"symfony/proxy-manager-bridge": "^2.3|^3.0",
"phpunit/phpunit": "^4.8",
"matthiasnoback/symfony-config-test": "^2.0",
"matthiasnoback/symfony-dependency-injection-test": "^1.1"
"matthiasnoback/symfony-dependency-injection-test": "^1.1",
"symfony/browser-kit": "^2.3|^3.0",
"symfony/property-access": "^2.3|^3.0",
"matthiasnoback/symfony-service-definition-validator": "^1.2"
},
"suggest": {
"psr/log-implementation": "Implementation for PSR3, LoggerInterface"
Expand Down
3 changes: 3 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@
<group>mongo</group>
</exclude>
</groups>
<php>
<server name="KERNEL_DIR" value="test/Functional/" />
</php>
</phpunit>
9 changes: 9 additions & 0 deletions src/BroadwayBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
use Broadway\Bundle\BroadwayBundle\DependencyInjection\RegisterMetadataEnricherSubscriberPass;
use Broadway\Bundle\BroadwayBundle\DependencyInjection\RegisterSagaCompilerPass;
use Broadway\Bundle\BroadwayBundle\DependencyInjection\RegisterSerializersCompilerPass;
use Matthias\SymfonyServiceDefinitionValidator\Compiler\ValidateServiceDefinitionsPass;
use Symfony\Component\Console\Application;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;

Expand Down Expand Up @@ -73,6 +75,13 @@ public function build(ContainerBuilder $container)
$container->addCompilerPass(
new RegisterSerializersCompilerPass()
);

if ($container->getParameter('kernel.debug')) {
$container->addCompilerPass(
new ValidateServiceDefinitionsPass(),
PassConfig::TYPE_AFTER_REMOVING
);
}
}

/**
Expand Down
21 changes: 0 additions & 21 deletions test/BroadwayBundleTest.php

This file was deleted.

39 changes: 39 additions & 0 deletions test/Functional/AppKernel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

/*
* This file is part of the broadway/broadway package.
*
* (c) Qandidate.com <opensource@qandidate.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

use Broadway\Bundle\BroadwayBundle\BroadwayBundle;
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\Kernel;

class AppKernel extends Kernel
{
/**
* {@inheritdoc}
*/
public function registerBundles()
{
return [
new FrameworkBundle(),
new DoctrineBundle(),
new BroadwayBundle(),
];
}

/**
* {@inheritdoc}
*/
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__ . '/config_functional.yml');
}
}
72 changes: 72 additions & 0 deletions test/Functional/BroadwayBundleTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php

/*
* This file is part of the broadway/broadway package.
*
* (c) Qandidate.com <opensource@qandidate.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Broadway\Bundle\BroadwayBundle\Functional;

use Broadway\Auditing\NullByteCommandSerializer;
use Broadway\EventDispatcher\EventDispatcher;
use Broadway\EventStore\Dbal\DBALEventStore;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

/**
* @group functional
*/
class BroadwayBundleTest extends WebTestCase
{
private $client;

public function setUp()
{
parent::setUp();

$this->client = static::createClient();
}

/**
* @test
*/
public function it_boots_the_application()
{
}

/**
* @test regression test
*/
public function it_instantiates_the_auditing_serializer()
{
$this->assertInstanceOf(
NullByteCommandSerializer::class,
$this->client->getContainer()->get('broadway.auditing.serializer')
);
}

/**
* @test regression test
*/
public function it_instantiates_the_event_dispatcher()
{
$this->assertInstanceOf(
EventDispatcher::class,
$this->client->getContainer()->get('broadway.event_dispatcher')
);
}

/**
* @test regression test
*/
public function it_instantiates_the_dbal_event_store()
{
$this->assertInstanceOf(
DBALEventStore::class,
$this->client->getContainer()->get('broadway.event_store.dbal')
);
}
}
20 changes: 20 additions & 0 deletions test/Functional/config_functional.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
framework:
test: ~
secret: "CQRS stands for Command Query Responsibility Segregation"

broadway:
event_store:
dbal:
enabled: true
command_handling:
logger: my_logger

services:
my_logger:
class: Monolog\Logger
arguments:
- "my_logger"

doctrine:
dbal:
driver: pdo_sqlite

0 comments on commit a98f317

Please sign in to comment.