Skip to content

Commit

Permalink
DI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
e-moe committed Jan 1, 2016
1 parent 8edf8a0 commit 1c90856
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/Tests/DependencyInjection/ConfigurationTest.php
@@ -0,0 +1,24 @@
<?php

namespace Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection;

use Emoe\GuzzleBundle\DependencyInjection\Configuration;
use Symfony\Component\Config\Definition\Processor;

class ConfigurationTest extends \PHPUnit_Framework_TestCase
{
public function testConfiguration()
{
$config = [
'emoe_guzzle' => [
'log' => [
'enabled' => true,
'format' => 'test',
]
]
];
$processor = new Processor();
$processedConfig = $processor->processConfiguration(new Configuration(), $config);
$this->assertEquals($config['emoe_guzzle'], $processedConfig);
}
}
23 changes: 23 additions & 0 deletions src/Tests/DependencyInjection/EmoeGuzzleExtensionTest.php
@@ -0,0 +1,23 @@
<?php

namespace Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection;

use Emoe\GuzzleBundle\DependencyInjection\EmoeGuzzleExtension;
use Prophecy\Argument;

class EmoeGuzzleExtensionTest extends \PHPUnit_Framework_TestCase
{
/**
* @SuppressWarnings(PHPMD.StaticAccess)
*/
public function testLoad()
{
$container = $this->prophesize('Symfony\Component\DependencyInjection\ContainerBuilder');

$extension = new EmoeGuzzleExtension();
$extension->load([], $container->reveal());

$container->setParameter('emoe_guzzle.log.enabled', Argument::type('bool'))->shouldHaveBeenCalled();
$container->setParameter('emoe_guzzle.log.format', Argument::type('string'))->shouldHaveBeenCalled();
}
}
26 changes: 26 additions & 0 deletions src/Tests/EmoeGuzzleBundleTest.php
@@ -0,0 +1,26 @@
<?php

namespace Doctrine\Bundle\DoctrineBundle\Tests;

use Emoe\GuzzleBundle\EmoeGuzzleBundle;
use Prophecy\Argument;

class EmoeGuzzleBundleTest extends \PHPUnit_Framework_TestCase
{
/**
* @SuppressWarnings(PHPMD.StaticAccess)
*/
public function testBuild()
{
$container = $this->prophesize('Symfony\Component\DependencyInjection\ContainerBuilder');
$container->addCompilerPass(
Argument::type('Emoe\GuzzleBundle\DependencyInjection\Compiler\ClientCompilerPass')
);
$container->addCompilerPass(
Argument::type('Emoe\GuzzleBundle\DependencyInjection\Compiler\MonologCompilerPass')
);

$bundle = new EmoeGuzzleBundle();
$bundle->build($container->reveal());
}
}

0 comments on commit 1c90856

Please sign in to comment.