php-parser/test/PhpParser/BuilderFactoryTest.php

25 lines
780 B
PHP

<?php
namespace PhpParser;
class BuilderFactoryTest extends \PHPUnit_Framework_TestCase
{
/**
* @dataProvider provideTestFactory
*/
public function testFactory($methodName, $className) {
$factory = new BuilderFactory;
$this->assertInstanceOf($className, $factory->$methodName('test'));
}
public function provideTestFactory() {
return array(
array('class', 'PhpParser\Builder\Class_'),
array('interface', 'PhpParser\Builder\Interface_'),
array('method', 'PhpParser\Builder\Method'),
array('function', 'PhpParser\Builder\Function_'),
array('property', 'PhpParser\Builder\Property'),
array('param', 'PhpParser\Builder\Param'),
);
}
}