Skip to content

Commit

Permalink
allow symfony 3, use phpunit 6, raise minimum php version to 7.1, ref… (
Browse files Browse the repository at this point in the history
#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
  • Loading branch information
temp authored and pl-github committed Sep 4, 2017
1 parent 4c8d626 commit 1822233
Show file tree
Hide file tree
Showing 13 changed files with 111 additions and 100 deletions.
15 changes: 9 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
language: php

php:
- 5.5
- 5.6
- 7
- hhvm
- 7.1
- nightly

matrix:
allow_failures:
- php:
- nightly

before_script: composer install

script: vendor/bin/phpunit -c tests --coverage-clover=coverage.clover
script: vendor/bin/phpunit --coverage-clover=coverage.clover

after_script:
- 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;'
- 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;'
26 changes: 16 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,28 @@
}
],
"require": {
"php": ">=5.4.0",
"brainbits/transcoder": "^2.0.2"
"php": "^7.1",
"brainbits/transcoder": "^3.0"
},
"require-dev": {
"php": ">=5.5.0",
"phpunit/phpunit": "~4.5",
"symfony/config": "^2.3",
"symfony/dependency-injection": "^2.3",
"symfony/http-kernel": "^2.3",
"matthiasnoback/symfony-config-test": "^1.4",
"matthiasnoback/symfony-dependency-injection-test": "^0.7.6"
"phpunit/phpunit": "^6.0",
"symfony/config": "^2.8|^3.0",
"symfony/dependency-injection": "^2.8|^3.0",
"symfony/http-kernel": "^2.8|^3.0",
"matthiasnoback/symfony-config-test": "^3.0",
"matthiasnoback/symfony-dependency-injection-test": "^2.0"
},
"autoload": {
"psr-4": { "Brainbits\\TranscoderBundle\\": "src/" }
},
"autoload-dev": {
"psr-4": { "Brainbits\\TranscoderBundle\\Tests\\": "tests/" }
}
},
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
6 changes: 3 additions & 3 deletions tests/phpunit.xml.dist → phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
syntaxCheck="true">
<testsuite name="brainbits">
<directory>.</directory>
<testsuite name="transcoder-bundle">
<directory>tests</directory>
</testsuite>
<filter>
<whitelist>
<directory suffix=".php">../src/</directory>
<directory suffix=".php">src</directory>
</whitelist>
</filter>
</phpunit>
9 changes: 5 additions & 4 deletions src/BrainbitsTranscoderBundle.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types = 1);

/*
* This file is part of the brainbits transcoder bundle package.
*
Expand All @@ -16,13 +19,11 @@
use Symfony\Component\HttpKernel\Bundle\Bundle;

/**
* brainbits transcoder bundle
*
* @author Phillip Look <plook@brainbits.net>
* brainbits transcoder bundle.
*/
class BrainbitsTranscoderBundle extends Bundle
{
public function build(ContainerBuilder $container)
public function build(ContainerBuilder $container): void
{
parent::build($container);

Expand Down
20 changes: 7 additions & 13 deletions src/DependencyInjection/BrainbitsTranscoderExtension.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types = 1);

/*
* This file is part of the brainbits transcoder bundle package.
*
Expand All @@ -11,27 +13,19 @@

namespace Brainbits\TranscoderBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
* This is the class that loads and manages your bundle configuration
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
*
* @author Gregor Welters <gwelters@brainbits.net>
* This is the class that loads and manages your bundle configuration.
*/
class BrainbitsTranscoderExtension extends Extension
{
/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container)
public function load(array $configs, ContainerBuilder $container): void
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));

$loader->load('decoders.xml');
$loader->load('encoders.xml');
Expand Down
9 changes: 7 additions & 2 deletions src/DependencyInjection/Compiler/AddDecoderPass.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types = 1);

/*
* This file is part of the brainbits transcoder bundle package.
*
Expand All @@ -11,13 +13,16 @@

namespace Brainbits\TranscoderBundle\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;

/**
* Add decoder pass.
*/
class AddDecoderPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
if (false === $container->hasDefinition('brainbits.transcoder.decoder.resolver')) {
return;
Expand Down
7 changes: 6 additions & 1 deletion src/DependencyInjection/Compiler/AddEncoderPass.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types = 1);

/*
* This file is part of the brainbits transcoder bundle package.
*
Expand All @@ -15,9 +17,12 @@
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Reference;

/**
* Add decoder pass.
*/
class AddEncoderPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
if (false === $container->hasDefinition('brainbits.transcoder.encoder.resolver')) {
return;
Expand Down
8 changes: 4 additions & 4 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types = 1);

/*
* This file is part of the brainbits transcoder bundle package.
*
Expand All @@ -15,13 +17,11 @@
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
* BrainbitsTranscoderExtension configuration structure.
*
* @author Stephan Wentz <swentz@brainbits.net>
* brainbits transcoder configuration.
*/
class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('brainbits_transcoder');
Expand Down
14 changes: 8 additions & 6 deletions tests/BrainbitsTranscoderBundleTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file is part of the brainbits transcoder bundle package.
*
Expand All @@ -13,23 +14,24 @@
use Brainbits\TranscoderBundle\BrainbitsTranscoderBundle;
use Brainbits\TranscoderBundle\DependencyInjection\Compiler\AddDecoderPass;
use Brainbits\TranscoderBundle\DependencyInjection\Compiler\AddEncoderPass;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Symfony\Component\DependencyInjection\ContainerBuilder;

/**
* Transcoder bundle test
*
* @author Stephan Wentz <swentz@brainbits.net>
* Transcoder bundle test.
*/
class BrainbitsTranscoderBundleTest extends \PHPUnit_Framework_TestCase
class BrainbitsTranscoderBundleTest extends TestCase
{
public function testBuild()
{
$bundle = new BrainbitsTranscoderBundle();

$container = $this->prophesize(ContainerBuilder::class);
$container->addCompilerPass(Argument::type(AddDecoderPass::class))->shouldBeCalled();
$container->addCompilerPass(Argument::type(AddEncoderPass::class))->shouldBeCalled();
$container->addCompilerPass(Argument::type(AddDecoderPass::class))
->shouldBeCalled();
$container->addCompilerPass(Argument::type(AddEncoderPass::class))
->shouldBeCalled();

$bundle->build($container->reveal());
}
Expand Down
16 changes: 7 additions & 9 deletions tests/DependencyInjection/BrainbitsTranscoderExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,15 @@
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase;

/**
* Extension test
*
* @author Stephan Wentz <swentz@brainbits.net>
* Extension test.
*/
class BrainbitsTranscoderExtensionTest extends AbstractExtensionTestCase
{
protected function getContainerExtensions()
{
return array(
return [
new BrainbitsTranscoderExtension()
);
];
}

public function testContainerHasDefaultParameters()
Expand All @@ -37,10 +35,10 @@ public function testContainerHasDefaultParameters()

public function testContainerHasProvidedParameters()
{
$this->load(array(
'encoder' => array('7z' => 'sevenZ'),
'decoder' => array('7z' => 'sevenZ'),
));
$this->load([
'encoder' => ['7z' => 'sevenZ'],
'decoder' => ['7z' => 'sevenZ'],
]);

$this->assertContainerBuilderHasParameter('brainbits.transcoder.decoder.7z.executable', 'sevenZ');
$this->assertContainerBuilderHasParameter('brainbits.transcoder.encoder.7z.executable', 'sevenZ');
Expand Down
4 changes: 1 addition & 3 deletions tests/DependencyInjection/Compiler/AddDecoderPassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@
namespace Brainbits\TranscoderBundle\Tests\DependencyInjection\Compiler;

use Brainbits\TranscoderBundle\DependencyInjection\Compiler\AddDecoderPass;
use PHPUnit_Framework_TestCase as TestCase;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;

/**
* Add decoder pass test
*
* @author Stephan Wentz <swentz@brainbits.net>
*/
class AddDecoderPassTest extends TestCase
{
Expand Down
4 changes: 1 addition & 3 deletions tests/DependencyInjection/Compiler/AddEncoderPassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@
namespace Brainbits\TranscoderBundle\Tests\DependencyInjection\Compiler;

use Brainbits\TranscoderBundle\DependencyInjection\Compiler\AddEncoderPass;
use PHPUnit_Framework_TestCase as TestCase;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;

/**
* Add encoder pass test
*
* @author Stephan Wentz <swentz@brainbits.net>
*/
class AddEncoderPassTest extends TestCase
{
Expand Down
Loading

0 comments on commit 1822233

Please sign in to comment.