ConfigServiceProviderTest.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /*
  3. * This file is part of ConfigServiceProvider.
  4. *
  5. * (c) Igor Wiedler <igor@wiedler.ch>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Igorw\Silex;
  11. /**
  12. * @author Igor Wiedler <igor@wiedler.ch>
  13. * @author Jérôme Macias <jerome.macias@gmail.com>
  14. */
  15. class GetFileFormatTest extends \PHPUnit_Framework_TestCase
  16. {
  17. /**
  18. * @dataProvider provideFilenamesForFormat
  19. */
  20. public function testGetFileFormat($filename)
  21. {
  22. $driver = new ChainConfigDriver(array(
  23. new PhpConfigDriver(),
  24. new YamlConfigDriver(),
  25. new JsonConfigDriver(),
  26. new TomlConfigDriver(),
  27. ));
  28. $this->assertTrue($driver->supports($filename));
  29. }
  30. public function provideFilenamesForFormat()
  31. {
  32. return array(
  33. 'yaml' => array(__DIR__."/Fixtures/config.yaml"),
  34. 'yml' => array(__DIR__."/Fixtures/config.yml"),
  35. 'yaml.dist' => array(__DIR__."/Fixtures/config.yaml.dist"),
  36. 'json' => array(__DIR__."/Fixtures/config.json"),
  37. 'json.dist' => array(__DIR__."/Fixtures/config.json.dist"),
  38. 'php' => array(__DIR__."/Fixtures/config.php"),
  39. 'php.dist' => array(__DIR__."/Fixtures/config.php.dist"),
  40. 'toml' => array(__DIR__."/Fixtures/config.toml"),
  41. 'toml.dist' => array(__DIR__."/Fixtures/config.toml.dist"),
  42. );
  43. }
  44. }