Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests, support PHP 7 and add travis build config
- Loading branch information
1 parent
17024ee
commit 8bd7a9d
Showing
8 changed files
with
196 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
language: php | ||
|
||
php: | ||
- 5.3 | ||
- 5.4 | ||
- 5.5 | ||
- 5.6 | ||
- 7.0 | ||
- hhvm | ||
|
||
sudo: false | ||
|
||
cache: | ||
directories: | ||
- $HOME/.composer | ||
|
||
env: | ||
- SYMFONY_VERSION=2.8.* | ||
|
||
matrix: | ||
include: | ||
- php: 5.6 | ||
env: SYMFONY_VERSION=2.3.* | ||
- php: 5.6 | ||
env: SYMFONY_VERSION=2.7.* | ||
- php: 7.0 | ||
|
||
before_install: | ||
- if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --no-update; fi; | ||
|
||
install: composer update --prefer-source $COMPOSER_FLAGS | ||
|
||
script: | ||
- vendor/bin/phpunit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
dubture_f_fmpeg: | ||
ffmpeg_binary: /usr/local/bin/ffmpeg | ||
ffprobe_binary: /usr/local/bin/ffprobe | ||
binary_timeout: 300 | ||
threads_count: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
dubture_f_fmpeg: | ||
ffmpeg_binary: /usr/local/bin/ffmpeg | ||
ffprobe_binary: /usr/local/bin/ffprobe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
namespace Dubture\FFmpegBundle\Tests\Unit\DependencyInjection; | ||
|
||
use Dubture\FFmpegBundle\DependencyInjection\Configuration; | ||
use Dubture\FFmpegBundle\DependencyInjection\DubtureFFmpegExtension; | ||
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionConfigurationTestCase; | ||
|
||
/** | ||
* Test the configuration parsed from YAML. | ||
* | ||
* @author Patrik Karisch <patrik@karisch.guru> | ||
*/ | ||
class ConfigurationTest extends AbstractExtensionConfigurationTestCase | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
protected function getContainerExtension() | ||
{ | ||
return new DubtureFFmpegExtension(); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
protected function getConfiguration() | ||
{ | ||
return new Configuration(); | ||
} | ||
|
||
public function testProcessedMinimumConfigurationContainsAllValues() | ||
{ | ||
$expectedConfiguration = array( | ||
'ffmpeg_binary' => '/usr/local/bin/ffmpeg', | ||
'ffprobe_binary' => '/usr/local/bin/ffprobe', | ||
'binary_timeout' => 60, | ||
'threads_count' => 4, | ||
); | ||
|
||
$sources = array( | ||
__DIR__.'/../../Fixtures/minimum.yml', | ||
); | ||
|
||
$this->assertProcessedConfigurationEquals( | ||
$expectedConfiguration, | ||
$sources | ||
); | ||
} | ||
|
||
public function testProcessedAllConfigurationContainsAllValues() | ||
{ | ||
$expectedConfiguration = array( | ||
'ffmpeg_binary' => '/usr/local/bin/ffmpeg', | ||
'ffprobe_binary' => '/usr/local/bin/ffprobe', | ||
'binary_timeout' => 300, | ||
'threads_count' => 2, | ||
); | ||
|
||
$sources = array( | ||
__DIR__.'/../../Fixtures/all.yml', | ||
); | ||
|
||
$this->assertProcessedConfigurationEquals($expectedConfiguration, $sources); | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
Tests/Unit/DependencyInjection/DubtureFFmpegExtensionTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
namespace Dubture\FFmpegBundle\Tests\Unit\DependencyInjection; | ||
|
||
use Dubture\FFmpegBundle\DependencyInjection\DubtureFFmpegExtension; | ||
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase; | ||
|
||
/** | ||
* Test the extensions which adds parameters and services | ||
* to the container. | ||
* | ||
* @author Patrik Karisch <patrik@karisch.guru> | ||
*/ | ||
class DubtureFFmpegExtensionTest extends AbstractExtensionTestCase | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
protected function getContainerExtensions() | ||
{ | ||
return array( | ||
new DubtureFFmpegExtension(), | ||
); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
protected function setUp() | ||
{ | ||
parent::setUp(); | ||
|
||
$this->load(array( | ||
'ffmpeg_binary' => '/usr/local/bin/ffmpeg', | ||
'ffprobe_binary' => '/usr/local/bin/ffprobe', | ||
)); | ||
} | ||
|
||
public function testAfterLoadingTheCorrectParametersHaveBeenSet() | ||
{ | ||
$this->assertContainerBuilderHasParameter('dubture_ffmpeg.binary', '/usr/local/bin/ffmpeg'); | ||
$this->assertContainerBuilderHasParameter('dubture_ffprobe.binary', '/usr/local/bin/ffprobe'); | ||
$this->assertContainerBuilderHasParameter('dubture_ffmpeg.binary_timeout', 60); | ||
$this->assertContainerBuilderHasParameter('dubture_ffmpeg.threads_count', 4); | ||
} | ||
|
||
public function testAfterLoadingTheFFMpegServiceExists() | ||
{ | ||
$this->assertContainerBuilderHasService('dubture_ffmpeg.ffmpeg', 'FFMpeg\FFMpeg'); | ||
} | ||
|
||
public function testAfterLoadingTheFFProbeServiceExists() | ||
{ | ||
$this->assertContainerBuilderHasService('dubture_ffmpeg.ffprobe', 'FFMpeg\FFProbe'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
$file = __DIR__ . '/../vendor/autoload.php'; | ||
if (!file_exists($file)) { | ||
throw new RuntimeException('Install dependencies to run test suite.'); | ||
} | ||
|
||
$autoload = require_once $file; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit bootstrap="./Tests/bootstrap.php" colors="true"> | ||
<testsuites> | ||
<testsuite name="unit"> | ||
<directory suffix="Test.php">./Tests/Unit</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<!-- Code coverage filter --> | ||
<filter> | ||
<whitelist> | ||
<directory>./</directory> | ||
<exclude> | ||
<directory>./Tests</directory> | ||
<directory>./vendor</directory> | ||
</exclude> | ||
</whitelist> | ||
</filter> | ||
</phpunit> |