fixture = ProjectFactory::createInstance(); } /** * @dataProvider fileProvider */ public function testFileDocblock(string $fileName) : void { $project = $this->fixture->create( 'MyProject', [new LocalFile($fileName)] ); $this->assertEquals( 'This file is part of phpDocumentor.', $project->getFiles()[$fileName]->getDocBlock()->getSummary() ); } public static function fileProvider() : array { return [ [ __DIR__ . '/data/GlobalFiles/empty.php' ], [ __DIR__ . '/data/GlobalFiles/empty_with_declare.php' ], [ __DIR__ . '/data/GlobalFiles/empty_shebang.php' ], [ __DIR__ . '/data/GlobalFiles/psr12.php' ], [ __DIR__ . '/data/GlobalFiles/docblock_followed_by_html.php' ], ]; } public function testConditionalFunctionDefine() : void { $fileName = __DIR__ . '/data/GlobalFiles/conditional_function.php'; $project = $this->fixture->create( 'MyProject', [new LocalFile($fileName)] ); $this->assertCount( 4, $project->getFiles()[$fileName]->getFunctions() ); } public function testGlobalNamespacedFunctionDefine() : void { $fileName = __DIR__ . '/data/GlobalFiles/global_namspaced_function.php'; $project = $this->fixture->create( 'MyProject', [new LocalFile($fileName)] ); $this->assertCount( 1, $project->getFiles()[$fileName]->getFunctions() ); } public function testFileWithInlineFunction() : void { $fileName = __DIR__ . '/data/GlobalFiles/inline_function.php'; $project = $this->fixture->create( 'MyProject', [new LocalFile($fileName)] ); $this->assertCount( 1, $project->getFiles()[$fileName]->getClasses() ); } }