Skip to content

Commit

Permalink
test DI extension
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-gribanov committed Mar 31, 2017
1 parent 37bfcd7 commit 0592a38
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"require-dev": {
"symfony/http-kernel": "~2.3|~3.0",
"symfony/dependency-injection": "~2.3|~3.0",
"symfony/expression-language": "~2.3|~3.0",
"symfony/console": "~2.3|~3.0",
"symfony/stopwatch": "~2.3|~3.0",
"composer/composer" : "~1.3",
Expand Down
46 changes: 46 additions & 0 deletions tests/DependencyInjection/GpsLabGeoIP2ExtensionTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php
/**
* GpsLab component.
*
* @author Peter Gribanov <info@peter-gribanov.ru>
* @copyright Copyright (c) 2011, Peter Gribanov
* @license http://opensource.org/licenses/MIT
*/

namespace GpsLab\Bundle\PaginationBundle\Tests\DependencyInjection;

use GpsLab\Bundle\GeoIP2Bundle\DependencyInjection\GpsLabGeoIP2Extension;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class GpsLabGeoIP2ExtensionTest extends \PHPUnit_Framework_TestCase
{
public function testLoad()
{
/* @var $container \PHPUnit_Framework_MockObject_MockObject|ContainerBuilder */
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder');
$container
->expects($this->at(0))
->method('setParameter')
->with('geoip2.cache', '%kernel.cache_dir%/GeoLite2-City.mmdb')
;
$container
->expects($this->at(1))
->method('setParameter')
->with('geoip2.url', 'http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz')
;
$container
->expects($this->at(2))
->method('setParameter')
->with('geoip2.locales', ['%locale%'])
;

$extension = new GpsLabGeoIP2Extension();
$extension->load([], $container);
}

public function testGetAlias()
{
$extension = new GpsLabGeoIP2Extension();
$this->assertEquals('gpslab_geoip', $extension->getAlias());
}
}

0 comments on commit 0592a38

Please sign in to comment.