Files
wp-agentic-writer/vendor/phpdocumentor/reflection/tests/integration/FileDocblockTest.php
Dwindi Ramadhana 690991c526 refactor: Cleanup git state - commit all staged changes
Major refactoring cleanup:
- Add new controller architecture (class-controller-*.php)
- Add new settings-v2 UI (views/settings-v2/)
- Add new CSS architecture (agentic-sidebar.css, tokens)
- Add esbuild build pipeline (scripts/build.js, package.json)
- Add composer dependencies (vendor/)
- Add frontend src directory (assets/js/src/index.jsx)
- Add documentation files
- Remove old/obsolete files (class-settings.php, old CSS)

This commits all pending changes from previous refactoring efforts.
2026-06-17 05:27:58 +07:00

97 lines
2.5 KiB
PHP

<?php
declare(strict_types=1);
namespace integration;
use phpDocumentor\Reflection\File\LocalFile;
use phpDocumentor\Reflection\Php\ProjectFactory;
use PHPUnit\Framework\Attributes\CoversNothing;
use PHPUnit\Framework\TestCase;
/**
* Integration tests to check the correct working of processing a namespace into a project.
*
* @coversNothing
*/
#[CoversNothing]
final class FileDocblockTest extends TestCase
{
/** @var ProjectFactory */
private $fixture;
protected function setUp() : void
{
$this->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()
);
}
}