Skip to content

Commit

Permalink
remove unnecessary second definition for service 'asm_translation_loa…
Browse files Browse the repository at this point in the history
…der.translation_manager', add dependency injection extension test
  • Loading branch information
xabbuh authored and Christian Flothmann committed Jan 14, 2014
1 parent 785fd09 commit 91bba28
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 7 deletions.
7 changes: 0 additions & 7 deletions Resources/config/services.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
parameters:
asm_translation_loader.translation_loader_class: 'Asm\TranslationLoaderBundle\Translation\DatabaseLoader'
asm_translation_loader.translation_model: 'Asm\TranslationLoaderBundle\Translation'
asm_translation_loader.history.subscriber_class: 'Asm\TranslationLoaderBundle\EventListener\TranslationHistorySubscriber'
asm_translation_loader.translation_manager_model: 'Asm\TranslationLoaderBundle\Model\TranslationManager'

services:
# database loader
Expand All @@ -20,8 +18,3 @@ services:
- [ setSecurityContext, [ "@security.context" ] ]
tags:
- { name: doctrine.event_subscriber }

# translation manager
asm_translation_loader.translation_manager:
class: '%asm_translation_loader.translation_manager_model%'
arguments: [ '%asm_translation_loader.translation_model%' ]
43 changes: 43 additions & 0 deletions Tests/DependencyInjection/AsmTranslatioLoaderExtensionTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

/*
* This file is part of the AsmTranslationLoaderBundle package.
*
* (c) Marc Aschmann <maschmann@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Asm\TranslationLoaderBundle\Tests\DependencyInjection;

use Asm\TranslationLoaderBundle\DependencyInjection\AsmTranslationLoaderExtension;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class AsmTranslatioLoaderExtensionTest extends \PHPUnit_Framework_TestCase
{
/**
* @var AsmTranslationLoaderExtension
*/
private $extension;

protected function setUp()
{
$this->extension = new AsmTranslationLoaderExtension();
}

public function testEmptyConfiguration()
{
$container = new ContainerBuilder();
$this->extension->load(array(), $container);

$this->assertTrue($container->hasDefinition('asm_translation_loader.translation_manager'));

// ensures that the translation manager service is injected into the
// database translation loader service
$this->assertEquals(
'asm_translation_loader.translation_manager',
$container->getDefinition('translation.loader.db')->getArgument(0)
);
}
}
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"require": {
"php": ">=5.3.0",
"symfony/framework-bundle": ">=2.1,<3.0",
"doctrine/doctrine-bundle": "~1.2",
"doctrine/orm": "~2.2,>=2.2.3"
},
"require-dev": {
Expand Down

0 comments on commit 91bba28

Please sign in to comment.