Skip to content

Commit d4df64d

Browse files
author
Reinier Kip
committed
Test the bundle against Symfony 2.3, 2.7 LTS, 2.8 LTS, 3.0 and PHP 5/7
1 parent 0daf69c commit d4df64d

File tree

6 files changed

+137
-1
lines changed

6 files changed

+137
-1
lines changed

.travis.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
sudo: false
2+
language: php
3+
4+
php:
5+
- 5.4
6+
- 5.5
7+
- nightly
8+
- hhvm
9+
10+
before_script:
11+
- composer self-update
12+
- if [ "$SYMFONY_VERSION" != "" ]; then composer require --no-update symfony/config:${SYMFONY_VERSION} symfony/dependency-injection:${SYMFONY_VERSION} symfony/event-dispatcher:${SYMFONY_VERSION} symfony/http-kernel:${SYMFONY_VERSION} symfony/framework-bundle:${SYMFONY_VERSION}; fi;
13+
- composer install --no-interaction --prefer-source --dev
14+
15+
script: phpunit --coverage-text --verbose
16+
17+
matrix:
18+
include:
19+
- php: 5.6
20+
env: [SYMFONY_VERSION="2.3.*"]
21+
- php: 5.6
22+
env: [SYMFONY_VERSION="2.7.*"]
23+
- php: 5.6
24+
env: [SYMFONY_VERSION="2.8.*"]
25+
- php: 5.6
26+
env: [SYMFONY_VERSION="3.0.*"]
27+
- php: 7.0
28+
env: [SYMFONY_VERSION="2.3.*"]
29+
- php: 7.0
30+
env: [SYMFONY_VERSION="2.7.*"]
31+
- php: 7.0
32+
env: [SYMFONY_VERSION="2.8.*"]
33+
- php: 7.0
34+
env: [SYMFONY_VERSION="3.0.*"]
35+
allow_failures:
36+
- php: nightly
37+
- php: hhvm
38+
fast_finish: true
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
namespace Tmdb\SymfonyBundle\Tests\DependencyInjection;
4+
5+
use PHPUnit_Framework_TestCase as TestCase;
6+
use Symfony\Component\DependencyInjection\Container;
7+
use Tmdb\SymfonyBundle\Tests\TestKernel;
8+
9+
final class TmdbSymfonyExtensionTest extends TestCase
10+
{
11+
/**
12+
* @test
13+
* @group DependencyInjection
14+
*/
15+
public function all_tmdb_services_can_be_loaded()
16+
{
17+
$kernel = new TestKernel('test', true);
18+
$kernel->boot();
19+
20+
/** @var Container $container */
21+
$container = $kernel->getContainer();
22+
$tmdbServiceIds = array_filter($container->getServiceIds(), function ($id) {
23+
return strpos($id, 'tmdb') === 0;
24+
});
25+
26+
foreach ($tmdbServiceIds as $serviceId) {
27+
$container->get($serviceId);
28+
}
29+
}
30+
}

Tests/TestKernel.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace Tmdb\SymfonyBundle\Tests;
4+
5+
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
6+
use Symfony\Component\Config\Loader\LoaderInterface;
7+
use Symfony\Component\HttpKernel\Kernel;
8+
use Tmdb\SymfonyBundle\TmdbSymfonyBundle;
9+
10+
final class TestKernel extends Kernel
11+
{
12+
public function registerBundles()
13+
{
14+
return [
15+
new FrameworkBundle(),
16+
new TmdbSymfonyBundle()
17+
];
18+
}
19+
20+
public function registerContainerConfiguration(LoaderInterface $loader)
21+
{
22+
$loader->load(__DIR__ . '/config.yml');
23+
}
24+
25+
public function getRootDir()
26+
{
27+
return sys_get_temp_dir() . '/php-tmdb-symfony-test';
28+
}
29+
30+
public function getCacheDir()
31+
{
32+
return $this->getRootDir() . '/cache';
33+
}
34+
35+
public function getLogDir()
36+
{
37+
return $this->getRootDir() . '/logs';
38+
}
39+
}

Tests/config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
framework:
2+
secret: NopeChuckTesta
3+
tmdb_symfony:
4+
api_key: invalidapikey

composer.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@
1919
"symfony/event-dispatcher": ">=2.3,<4",
2020
"symfony/http-kernel": ">=2.3,<4",
2121
"doctrine/doctrine-cache-bundle": "~1.0",
22-
"php-tmdb/api": "~2.0"
22+
"php-tmdb/api": "^2.0.14",
2323
"twig/twig": "~1.11|~2.0"
2424
},
25+
"require-dev": {
26+
"phpunit/phpunit": "^5.2",
27+
"symfony/framework-bundle": ">=2.3,<4"
28+
},
2529
"autoload": {
2630
"psr-4": { "Tmdb\\SymfonyBundle\\": "" }
2731
}

phpunit.xml.dist

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<phpunit backupGlobals="false"
2+
backupStaticAttributes="false"
3+
colors="true"
4+
convertErrorsToExceptions="true"
5+
convertNoticesToExceptions="true"
6+
convertWarningsToExceptions="true"
7+
processIsolation="false"
8+
stopOnFailure="false"
9+
syntaxCheck="false"
10+
bootstrap="vendor/autoload.php">
11+
<testsuites>
12+
<testsuite name="php-tmdb-symfony Test Suite">
13+
<directory>./Tests/</directory>
14+
</testsuite>
15+
</testsuites>
16+
<filter>
17+
<whitelist>
18+
<directory suffix=".php">./Tests/</directory>
19+
</whitelist>
20+
</filter>
21+
</phpunit>

0 commit comments

Comments
 (0)