ParserIniTest.php

  1. 8.0.x tests/Drush/Tests/Make/Parser/ParserIniTest.php
  2. 7.x tests/Drush/Tests/Make/Parser/ParserIniTest.php
  3. master tests/Drush/Tests/Make/Parser/ParserIniTest.php

Namespace

Drush\Tests\Make\Parser

Classes

Namesort descending Description
ParserIniTest @coversDefaultClass \Drush\Make\Parser\ParserIni

File

tests/Drush/Tests/Make/Parser/ParserIniTest.php
View source
  1. <?php
  2. namespace Drush\Tests\Make\Parser;
  3. use Drush\Make\Parser\ParserIni;
  4. /**
  5. * @coversDefaultClass \Drush\Make\Parser\ParserIni
  6. */
  7. class ParserIniTest extends \PHPUnit_Framework_TestCase {
  8. /**
  9. * @covers ::supportedFile
  10. */
  11. public function testSupportedFile() {
  12. $this->assertFalse(ParserIni::supportedFile('-'));
  13. $this->assertFalse(ParserIni::supportedFile('/tmp/foo/bar/baz.make.yml'));
  14. $this->assertTrue(ParserIni::supportedFile('./baz/foo.make'));
  15. }
  16. /**
  17. * @dataProvider providerParse
  18. * @covers ::parse
  19. */
  20. public function testParse($ini, $expected) {
  21. $parsed = ParserIni::parse($ini);
  22. $this->assertSame($expected, $parsed);
  23. }
  24. /**
  25. * Provides INI snippets to test the parser.
  26. */
  27. public function providerParse() {
  28. $snippets[] = array('foo[bar][baz] = one', array('foo' => array('bar' => array('baz' => 'one'))));
  29. $snippets[] = array("; A comment should not be part of the returned array\nprojects[] = drupal", array('projects' => array('drupal')));
  30. // @todo make more tests.
  31. return $snippets;
  32. }
  33. }