Skip to content

Commit 1822233

Browse files
temppl-github
authored andcommitted
allow symfony 3, use phpunit 6, raise minimum php version to 7.1, ref… (#5)
* allow symfony 3, use phpunit 6, raise minimum php version to 7.1, refactorings and bugfixes * fix travis config * prefer stable packages, allow dev packages
1 parent 4c8d626 commit 1822233

13 files changed

+111
-100
lines changed

.travis.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
language: php
22

33
php:
4-
- 5.5
5-
- 5.6
6-
- 7
7-
- hhvm
4+
- 7.1
5+
- nightly
6+
7+
matrix:
8+
allow_failures:
9+
- php:
10+
- nightly
811

912
before_script: composer install
1013

11-
script: vendor/bin/phpunit -c tests --coverage-clover=coverage.clover
14+
script: vendor/bin/phpunit --coverage-clover=coverage.clover
1215

1316
after_script:
14-
- sh -c 'if [ $(phpenv version-name) = "5.6" ]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi;'
17+
- sh -c 'if [ $(phpenv version-name) = "7.1" ]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi;'

composer.json

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,28 @@
1919
}
2020
],
2121
"require": {
22-
"php": ">=5.4.0",
23-
"brainbits/transcoder": "^2.0.2"
22+
"php": "^7.1",
23+
"brainbits/transcoder": "^3.0"
2424
},
2525
"require-dev": {
26-
"php": ">=5.5.0",
27-
"phpunit/phpunit": "~4.5",
28-
"symfony/config": "^2.3",
29-
"symfony/dependency-injection": "^2.3",
30-
"symfony/http-kernel": "^2.3",
31-
"matthiasnoback/symfony-config-test": "^1.4",
32-
"matthiasnoback/symfony-dependency-injection-test": "^0.7.6"
26+
"phpunit/phpunit": "^6.0",
27+
"symfony/config": "^2.8|^3.0",
28+
"symfony/dependency-injection": "^2.8|^3.0",
29+
"symfony/http-kernel": "^2.8|^3.0",
30+
"matthiasnoback/symfony-config-test": "^3.0",
31+
"matthiasnoback/symfony-dependency-injection-test": "^2.0"
3332
},
3433
"autoload": {
3534
"psr-4": { "Brainbits\\TranscoderBundle\\": "src/" }
3635
},
3736
"autoload-dev": {
3837
"psr-4": { "Brainbits\\TranscoderBundle\\Tests\\": "tests/" }
39-
}
38+
},
39+
"extra": {
40+
"branch-alias": {
41+
"dev-master": "3.0-dev"
42+
}
43+
},
44+
"minimum-stability": "dev",
45+
"prefer-stable": true
4046
}

tests/phpunit.xml.dist renamed to phpunit.xml.dist

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
convertNoticesToExceptions="true"
66
convertWarningsToExceptions="true"
77
syntaxCheck="true">
8-
<testsuite name="brainbits">
9-
<directory>.</directory>
8+
<testsuite name="transcoder-bundle">
9+
<directory>tests</directory>
1010
</testsuite>
1111
<filter>
1212
<whitelist>
13-
<directory suffix=".php">../src/</directory>
13+
<directory suffix=".php">src</directory>
1414
</whitelist>
1515
</filter>
1616
</phpunit>

src/BrainbitsTranscoderBundle.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<?php
2+
3+
declare(strict_types = 1);
4+
25
/*
36
* This file is part of the brainbits transcoder bundle package.
47
*
@@ -16,13 +19,11 @@
1619
use Symfony\Component\HttpKernel\Bundle\Bundle;
1720

1821
/**
19-
* brainbits transcoder bundle
20-
*
21-
* @author Phillip Look <[email protected]>
22+
* brainbits transcoder bundle.
2223
*/
2324
class BrainbitsTranscoderBundle extends Bundle
2425
{
25-
public function build(ContainerBuilder $container)
26+
public function build(ContainerBuilder $container): void
2627
{
2728
parent::build($container);
2829

src/DependencyInjection/BrainbitsTranscoderExtension.php

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types = 1);
4+
35
/*
46
* This file is part of the brainbits transcoder bundle package.
57
*
@@ -11,27 +13,19 @@
1113

1214
namespace Brainbits\TranscoderBundle\DependencyInjection;
1315

14-
use Symfony\Component\DependencyInjection\ContainerBuilder;
1516
use Symfony\Component\Config\FileLocator;
16-
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
17-
use Symfony\Component\DependencyInjection\Loader;
17+
use Symfony\Component\DependencyInjection\ContainerBuilder;
1818
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
19+
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
1920

2021
/**
21-
* This is the class that loads and manages your bundle configuration
22-
*
23-
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
24-
*
25-
* @author Gregor Welters <[email protected]>
22+
* This is the class that loads and manages your bundle configuration.
2623
*/
2724
class BrainbitsTranscoderExtension extends Extension
2825
{
29-
/**
30-
* {@inheritDoc}
31-
*/
32-
public function load(array $configs, ContainerBuilder $container)
26+
public function load(array $configs, ContainerBuilder $container): void
3327
{
34-
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
28+
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
3529

3630
$loader->load('decoders.xml');
3731
$loader->load('encoders.xml');

src/DependencyInjection/Compiler/AddDecoderPass.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types = 1);
4+
35
/*
46
* This file is part of the brainbits transcoder bundle package.
57
*
@@ -11,13 +13,16 @@
1113

1214
namespace Brainbits\TranscoderBundle\DependencyInjection\Compiler;
1315

14-
use Symfony\Component\DependencyInjection\ContainerBuilder;
1516
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
17+
use Symfony\Component\DependencyInjection\ContainerBuilder;
1618
use Symfony\Component\DependencyInjection\Reference;
1719

20+
/**
21+
* Add decoder pass.
22+
*/
1823
class AddDecoderPass implements CompilerPassInterface
1924
{
20-
public function process(ContainerBuilder $container)
25+
public function process(ContainerBuilder $container): void
2126
{
2227
if (false === $container->hasDefinition('brainbits.transcoder.decoder.resolver')) {
2328
return;

src/DependencyInjection/Compiler/AddEncoderPass.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types = 1);
4+
35
/*
46
* This file is part of the brainbits transcoder bundle package.
57
*
@@ -15,9 +17,12 @@
1517
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1618
use Symfony\Component\DependencyInjection\Reference;
1719

20+
/**
21+
* Add decoder pass.
22+
*/
1823
class AddEncoderPass implements CompilerPassInterface
1924
{
20-
public function process(ContainerBuilder $container)
25+
public function process(ContainerBuilder $container): void
2126
{
2227
if (false === $container->hasDefinition('brainbits.transcoder.encoder.resolver')) {
2328
return;

src/DependencyInjection/Configuration.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types = 1);
4+
35
/*
46
* This file is part of the brainbits transcoder bundle package.
57
*
@@ -15,13 +17,11 @@
1517
use Symfony\Component\Config\Definition\ConfigurationInterface;
1618

1719
/**
18-
* BrainbitsTranscoderExtension configuration structure.
19-
*
20-
* @author Stephan Wentz <[email protected]>
20+
* brainbits transcoder configuration.
2121
*/
2222
class Configuration implements ConfigurationInterface
2323
{
24-
public function getConfigTreeBuilder()
24+
public function getConfigTreeBuilder(): TreeBuilder
2525
{
2626
$treeBuilder = new TreeBuilder();
2727
$rootNode = $treeBuilder->root('brainbits_transcoder');

tests/BrainbitsTranscoderBundleTest.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/*
34
* This file is part of the brainbits transcoder bundle package.
45
*
@@ -13,23 +14,24 @@
1314
use Brainbits\TranscoderBundle\BrainbitsTranscoderBundle;
1415
use Brainbits\TranscoderBundle\DependencyInjection\Compiler\AddDecoderPass;
1516
use Brainbits\TranscoderBundle\DependencyInjection\Compiler\AddEncoderPass;
17+
use PHPUnit\Framework\TestCase;
1618
use Prophecy\Argument;
1719
use Symfony\Component\DependencyInjection\ContainerBuilder;
1820

1921
/**
20-
* Transcoder bundle test
21-
*
22-
* @author Stephan Wentz <[email protected]>
22+
* Transcoder bundle test.
2323
*/
24-
class BrainbitsTranscoderBundleTest extends \PHPUnit_Framework_TestCase
24+
class BrainbitsTranscoderBundleTest extends TestCase
2525
{
2626
public function testBuild()
2727
{
2828
$bundle = new BrainbitsTranscoderBundle();
2929

3030
$container = $this->prophesize(ContainerBuilder::class);
31-
$container->addCompilerPass(Argument::type(AddDecoderPass::class))->shouldBeCalled();
32-
$container->addCompilerPass(Argument::type(AddEncoderPass::class))->shouldBeCalled();
31+
$container->addCompilerPass(Argument::type(AddDecoderPass::class))
32+
->shouldBeCalled();
33+
$container->addCompilerPass(Argument::type(AddEncoderPass::class))
34+
->shouldBeCalled();
3335

3436
$bundle->build($container->reveal());
3537
}

tests/DependencyInjection/BrainbitsTranscoderExtensionTest.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,15 @@
1414
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase;
1515

1616
/**
17-
* Extension test
18-
*
19-
* @author Stephan Wentz <[email protected]>
17+
* Extension test.
2018
*/
2119
class BrainbitsTranscoderExtensionTest extends AbstractExtensionTestCase
2220
{
2321
protected function getContainerExtensions()
2422
{
25-
return array(
23+
return [
2624
new BrainbitsTranscoderExtension()
27-
);
25+
];
2826
}
2927

3028
public function testContainerHasDefaultParameters()
@@ -37,10 +35,10 @@ public function testContainerHasDefaultParameters()
3735

3836
public function testContainerHasProvidedParameters()
3937
{
40-
$this->load(array(
41-
'encoder' => array('7z' => 'sevenZ'),
42-
'decoder' => array('7z' => 'sevenZ'),
43-
));
38+
$this->load([
39+
'encoder' => ['7z' => 'sevenZ'],
40+
'decoder' => ['7z' => 'sevenZ'],
41+
]);
4442

4543
$this->assertContainerBuilderHasParameter('brainbits.transcoder.decoder.7z.executable', 'sevenZ');
4644
$this->assertContainerBuilderHasParameter('brainbits.transcoder.encoder.7z.executable', 'sevenZ');

0 commit comments

Comments
 (0)