2014-02-06 14:44:16 +01:00
|
|
|
<?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_'),
|
2014-12-19 17:58:47 +01:00
|
|
|
array('trait', 'PhpParser\Builder\Trait_'),
|
2014-02-06 14:44:16 +01:00
|
|
|
array('method', 'PhpParser\Builder\Method'),
|
|
|
|
array('function', 'PhpParser\Builder\Function_'),
|
|
|
|
array('property', 'PhpParser\Builder\Property'),
|
|
|
|
array('param', 'PhpParser\Builder\Param'),
|
|
|
|
);
|
|
|
|
}
|
2014-12-19 17:58:47 +01:00
|
|
|
}
|