1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-12-16 11:26:55 +01:00
PHP-Parser/test/PHPParser/Tests/NodeDumperTest.php

57 lines
1.1 KiB
PHP
Raw Normal View History

2011-07-13 23:07:05 +02:00
<?php
class PHPParser_Tests_NodeDumperTest extends PHPUnit_Framework_TestCase
2011-07-13 23:07:05 +02:00
{
/**
* @dataProvider provideTestDump
*/
public function testDump($node, $dump) {
$nodeDumper = new PHPParser_NodeDumper;
$this->assertEquals($dump, $nodeDumper->dump($node));
}
public function provideTestDump() {
return array(
array(
array(),
'array(
)'
),
array(
array('Foo', 'Bar', 'Key' => 'FooBar'),
'array(
0: Foo
1: Bar
Key: FooBar
)'
),
array(
new PHPParser_Node_Name(array('Hallo', 'World')),
2011-07-13 23:07:05 +02:00
'Name(
parts: array(
0: Hallo
1: World
)
type: 0
2011-07-13 23:07:05 +02:00
)'
),
array(
new PHPParser_Node_Expr_Array(array(
new PHPParser_Node_Expr_ArrayItem(null, new PHPParser_Node_Scalar_String('Foo'))
)),
2011-07-13 23:07:05 +02:00
'Expr_Array(
items: array(
0: Expr_ArrayItem(
key: null
value: Scalar_String(
value: Foo
)
2011-07-13 23:07:05 +02:00
byRef: false
)
)
)'
),
);
}
}