-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathPegGrammarTest.php
More file actions
38 lines (32 loc) · 899 Bytes
/
PegGrammarTest.php
File metadata and controls
38 lines (32 loc) · 899 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/*
* This file is part of the peg package.
*
* (c) 2016 Wouter de Jong
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace WouterJ\Peg;
use PHPUnit\Framework\TestCase;
/**
* @author Wouter de Jong <wouter@wouterj.nl>
*/
class PegGrammarTest extends TestCase
{
/** @dataProvider getGrammars */
public function testGrammar($filePath)
{
$grammar = new PegGrammar();
$parsedGrammar = $grammar->parse(file_get_contents($filePath));
$this->assertInstanceOf(Grammar::class, $parsedGrammar);
$this->assertEquals('A nice sentence!', $parsedGrammar->parse('A nice sentence!'));
}
public function getGrammars()
{
return [
//[__DIR__.'/fixtures/example1.peg'],
[__DIR__.'/fixtures/simple.peg'],
];
}
}