class ParserIniTest

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

@coversDefaultClass \Drush\Make\Parser\ParserIni

Namespace

Drush\Tests\Make\Parser

Hierarchy

Expanded class hierarchy of ParserIniTest

Members

Contains filters are case sensitive
Name Modifiers Type Descriptionsort descending
ParserIniTest::testSupportedFile public function @covers ::supportedFile
ParserIniTest::testParse public function @dataProvider providerParse @covers ::parse
ParserIniTest::providerParse public function Provides INI snippets to test the parser.

File

tests/Drush/Tests/Make/Parser/ParserIniTest.php, line 10

View source
class ParserIniTest extends \PHPUnit_Framework_TestCase {

  /**
   * @covers ::supportedFile
   */
  public function testSupportedFile() {
    $this->assertFalse(ParserIni::supportedFile('-'));
    $this->assertFalse(ParserIni::supportedFile('/tmp/foo/bar/baz.make.yml'));
    $this->assertTrue(ParserIni::supportedFile('./baz/foo.make'));
  }

  /**
   * @dataProvider providerParse
   * @covers ::parse
   */
  public function testParse($ini, $expected) {
    $parsed = ParserIni::parse($ini);
    $this->assertSame($expected, $parsed);
  }

  /**
   * Provides INI snippets to test the parser.
   */
  public function providerParse() {
    $snippets[] = array('foo[bar][baz] = one', array('foo' => array('bar' => array('baz' => 'one'))));
    $snippets[] = array("; A comment should not be part of the returned array\nprojects[] = drupal", array('projects' => array('drupal')));

    // @todo make more tests.
    return $snippets;
  }

}