Skip to content

Commit baa643d

Browse files
committed
Added initial simple test
1 parent 2110170 commit baa643d

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed

unit-tests/Data/.gitkeep

Whitespace-only changes.

unit-tests/Data/simple/example.zep

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace Example;
2+
3+
class Test
4+
{
5+
public foo;
6+
protected bar;
7+
private baz;
8+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?php
2+
3+
namespace Zephir\Parser\Tests;
4+
5+
class ParserSimpleTest extends TestCase
6+
{
7+
/** @test */
8+
public function shouldProperlyParseTheFile()
9+
{
10+
$path = $this->dataPath('simple/example.zep');
11+
$expected = [
12+
[
13+
'type' => 'namespace',
14+
'name' => 'Example',
15+
'file' => $path,
16+
'line' => 3,
17+
'char' => 5,
18+
],
19+
[
20+
'type' => 'class',
21+
'name' => 'Test',
22+
'abstract' => 0,
23+
'final' => 0,
24+
'definition' => [
25+
'properties' => [
26+
[
27+
'visibility' => ['public'],
28+
'type' => 'property',
29+
'name' => 'foo',
30+
'file' => $path,
31+
'line' => 6,
32+
'char' => 10,
33+
],
34+
[
35+
'visibility' => ['protected'],
36+
'type' => 'property',
37+
'name' => 'bar',
38+
'file' => $path,
39+
'line' => 7,
40+
'char' => 8,
41+
],
42+
[
43+
'visibility' => ['private'],
44+
'type' => 'property',
45+
'name' => 'baz',
46+
'file' => $path,
47+
'line' => 8,
48+
'char' => 1,
49+
],
50+
],
51+
'file' => $path,
52+
'line' => 3,
53+
'char' => 5,
54+
],
55+
'file' => $path,
56+
'line' => 3,
57+
'char' => 5,
58+
],
59+
];
60+
61+
$this->assertSame($expected, $this->parseFile('simple/example.zep'));
62+
}
63+
}

0 commit comments

Comments
 (0)