Skip to content

Commit 53c4618

Browse files
author
Stephan Wentz
committed
add missing tests
1 parent 9cdfd35 commit 53c4618

5 files changed

Lines changed: 88 additions & 0 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
/*
3+
* This file is part of the brainbits transcoder bundle package.
4+
*
5+
* (c) brainbits GmbH
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
11+
namespace Brainbits\TranscoderBundle\Tests;
12+
13+
use Brainbits\TranscoderBundle\BrainbitsTranscoderBundle;
14+
use Brainbits\TranscoderBundle\DependencyInjection\Compiler\AddDecoderPass;
15+
use Brainbits\TranscoderBundle\DependencyInjection\Compiler\AddEncoderPass;
16+
use Prophecy\Argument;
17+
use Symfony\Component\DependencyInjection\ContainerBuilder;
18+
19+
/**
20+
* Transcoder bundle test
21+
*
22+
* @author Stephan Wentz <swentz@brainbits.net>
23+
*/
24+
class BrainbitsTranscoderBundleTest extends \PHPUnit_Framework_TestCase
25+
{
26+
public function testBuild()
27+
{
28+
$bundle = new BrainbitsTranscoderBundle();
29+
30+
$container = $this->prophesize(ContainerBuilder::class);
31+
$container->addCompilerPass(Argument::type(AddDecoderPass::class))->shouldBeCalled();
32+
$container->addCompilerPass(Argument::type(AddEncoderPass::class))->shouldBeCalled();
33+
34+
$bundle->build($container->reveal());
35+
}
36+
}

tests/DependencyInjection/BrainbitsTranscoderExtensionTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
use Brainbits\TranscoderBundle\DependencyInjection\BrainbitsTranscoderExtension;
1414
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase;
1515

16+
/**
17+
* Extension test
18+
*
19+
* @author Stephan Wentz <swentz@brainbits.net>
20+
*/
1621
class BrainbitsTranscoderExtensionTest extends AbstractExtensionTestCase
1722
{
1823
protected function getContainerExtensions()

tests/DependencyInjection/Compiler/AddDecoderPassTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,29 @@
1616
use Symfony\Component\DependencyInjection\Definition;
1717
use Symfony\Component\DependencyInjection\Reference;
1818

19+
/**
20+
* Add decoder pass test
21+
*
22+
* @author Stephan Wentz <swentz@brainbits.net>
23+
*/
1924
class AddDecoderPassTest extends TestCase
2025
{
26+
public function testProcessWithoutDefinition()
27+
{
28+
$pass = new AddDecoderPass();
29+
30+
$definition = new Definition(null, array(null));
31+
32+
$container = $this->prophesize(ContainerBuilder::class);
33+
$container->hasDefinition('brainbits.transcoder.decoder.resolver')->willReturn(false);
34+
$container->findTaggedServiceIds('transcoder.decoder')->shouldNotBeCalled();
35+
$container->getDefinition('brainbits.transcoder.decoder.resolver')->shouldNotBeCalled();
36+
37+
$pass->process($container->reveal());
38+
39+
$this->assertNull($definition->getArgument(0)[0]);
40+
}
41+
2142
public function testProcess()
2243
{
2344
$pass = new AddDecoderPass();

tests/DependencyInjection/Compiler/AddEncoderPassTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,29 @@
1616
use Symfony\Component\DependencyInjection\Definition;
1717
use Symfony\Component\DependencyInjection\Reference;
1818

19+
/**
20+
* Add encoder pass test
21+
*
22+
* @author Stephan Wentz <swentz@brainbits.net>
23+
*/
1924
class AddEncoderPassTest extends TestCase
2025
{
26+
public function testProcessWithoutDefinition()
27+
{
28+
$pass = new AddEncoderPass();
29+
30+
$definition = new Definition(null, array(null));
31+
32+
$container = $this->prophesize(ContainerBuilder::class);
33+
$container->hasDefinition('brainbits.transcoder.encoder.resolver')->willReturn(false);
34+
$container->findTaggedServiceIds('transcoder.encoder')->shouldNotBeCalled();
35+
$container->getDefinition('brainbits.transcoder.encoder.resolver')->shouldNotBeCalled();
36+
37+
$pass->process($container->reveal());
38+
39+
$this->assertNull($definition->getArgument(0)[0]);
40+
}
41+
2142
public function testProcess()
2243
{
2344
$pass = new AddEncoderPass();

tests/DependencyInjection/ConfigurationTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
use Brainbits\TranscoderBundle\DependencyInjection\Configuration;
1414
use Matthias\SymfonyConfigTest\PhpUnit\AbstractConfigurationTestCase;
1515

16+
/**
17+
* Configuration test
18+
*
19+
* @author Stephan Wentz <swentz@brainbits.net>
20+
*/
1621
class ConfigurationTest extends AbstractConfigurationTestCase
1722
{
1823
protected function getConfiguration()

0 commit comments

Comments
 (0)