|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Dubture\FFmpegBundle\Tests\Unit\DependencyInjection; |
| 4 | + |
| 5 | +use Dubture\FFmpegBundle\DependencyInjection\Configuration; |
| 6 | +use Dubture\FFmpegBundle\DependencyInjection\DubtureFFmpegExtension; |
| 7 | +use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionConfigurationTestCase; |
| 8 | + |
| 9 | +/** |
| 10 | + * Test the configuration parsed from YAML. |
| 11 | + * |
| 12 | + * @author Patrik Karisch <patrik@karisch.guru> |
| 13 | + */ |
| 14 | +class ConfigurationTest extends AbstractExtensionConfigurationTestCase |
| 15 | +{ |
| 16 | + /** |
| 17 | + * {@inheritDoc} |
| 18 | + */ |
| 19 | + protected function getContainerExtension() |
| 20 | + { |
| 21 | + return new DubtureFFmpegExtension(); |
| 22 | + } |
| 23 | + |
| 24 | + /** |
| 25 | + * {@inheritDoc} |
| 26 | + */ |
| 27 | + protected function getConfiguration() |
| 28 | + { |
| 29 | + return new Configuration(); |
| 30 | + } |
| 31 | + |
| 32 | + public function testProcessedMinimumConfigurationContainsAllValues() |
| 33 | + { |
| 34 | + $expectedConfiguration = array( |
| 35 | + 'ffmpeg_binary' => '/usr/local/bin/ffmpeg', |
| 36 | + 'ffprobe_binary' => '/usr/local/bin/ffprobe', |
| 37 | + 'binary_timeout' => 60, |
| 38 | + 'threads_count' => 4, |
| 39 | + ); |
| 40 | + |
| 41 | + $sources = array( |
| 42 | + __DIR__.'/../../Fixtures/minimum.yml', |
| 43 | + ); |
| 44 | + |
| 45 | + $this->assertProcessedConfigurationEquals( |
| 46 | + $expectedConfiguration, |
| 47 | + $sources |
| 48 | + ); |
| 49 | + } |
| 50 | + |
| 51 | + public function testProcessedAllConfigurationContainsAllValues() |
| 52 | + { |
| 53 | + $expectedConfiguration = array( |
| 54 | + 'ffmpeg_binary' => '/usr/local/bin/ffmpeg', |
| 55 | + 'ffprobe_binary' => '/usr/local/bin/ffprobe', |
| 56 | + 'binary_timeout' => 300, |
| 57 | + 'threads_count' => 2, |
| 58 | + ); |
| 59 | + |
| 60 | + $sources = array( |
| 61 | + __DIR__.'/../../Fixtures/all.yml', |
| 62 | + ); |
| 63 | + |
| 64 | + $this->assertProcessedConfigurationEquals($expectedConfiguration, $sources); |
| 65 | + } |
| 66 | +} |
0 commit comments