Skip to content

Commit 94f6bcf

Browse files
committed
Update GitHub Pages
1 parent bb22bd7 commit 94f6bcf

5 files changed

Lines changed: 58 additions & 109 deletions

File tree

docs/running/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ In this Section
1313

1414
unified-command
1515
specialized-commands
16+
reports

docs/running/reports.rst

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
Test Reports
2+
============
3+
4+
FastForward DevTools provides a unified mechanism to generate and aggregate multiple types of reports, including API documentation and testing metrics, into a clean and accessible directory structure.
5+
6+
The Reports Command (``reports``)
7+
---------------------------------
8+
9+
The ``reports`` command is the high-level orchestrator that sequentially runs the documentation and testing suites with coverage enabled. It then generates a central entry point (``index.html``) in your project's ``public/`` directory.
10+
11+
.. code-block:: bash
12+
13+
composer dev-tools reports
14+
15+
Unified Output Structure
16+
------------------------
17+
18+
When you run the reports command, the following structure is created in your project root:
19+
20+
.. code-block:: text
21+
22+
public/
23+
├── index.html # The main frontpage linking to all reports
24+
├── docs/ # Generated HTML API documentation (phpDocumentor)
25+
└── coverage/ # Testing reports (PHPUnit)
26+
├── index.html # Detailed HTML Code Coverage report
27+
├── testdox.html # Human-readable Testdox execution report
28+
├── clover.xml # XML coverage for CI integration
29+
└── coverage.php # Raw PHP coverage data
30+
31+
Code Coverage
32+
-------------
33+
34+
The Code Coverage report provides a visual representation of which lines of your code are executed by your tests. It helps identify untested areas of the codebase.
35+
36+
- **Location**: ``public/coverage/index.html``
37+
- **Generation**: Triggered by ``composer dev-tools reports`` or ``composer dev-tools tests --coverage=public/coverage``.
38+
39+
Testdox
40+
-------
41+
42+
The Testdox report transforms your technical test case names into a human-readable list of behavioral expectations, serving as a form of living documentation for your project's functionality.
43+
44+
- **Location**: ``public/coverage/testdox.html``
45+
- **Generation**: Automatically included whenever coverage is generated via the ``reports`` or ``tests`` commands.
46+
47+
Live Reports (GitHub Pages)
48+
---------------------------
49+
50+
For the latest status of the ``main`` branch, you can access the live reports deployed via GitHub Actions:
51+
52+
- **Full Documentation Hub**: `https://php-fast-forward.github.io/dev-tools/ <https://php-fast-forward.github.io/dev-tools/>`_
53+
- **API Documentation**: `https://php-fast-forward.github.io/dev-tools/docs/ <https://php-fast-forward.github.io/dev-tools/docs/>`_
54+
- **Code Coverage**: `https://php-fast-forward.github.io/dev-tools/coverage/ <https://php-fast-forward.github.io/dev-tools/coverage/>`_
55+
- **Testdox Report**: `https://php-fast-forward.github.io/dev-tools/coverage/testdox.html <https://php-fast-forward.github.io/dev-tools/coverage/testdox.html>`_

resources/index.php

Lines changed: 0 additions & 54 deletions
This file was deleted.

src/Command/ReportsCommand.php

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
use Symfony\Component\Console\Input\InputInterface;
2222
use Symfony\Component\Console\Output\OutputInterface;
2323

24-
use function Safe\ob_start;
25-
use function Safe\ob_get_clean;
2624

2725
/**
2826
* Coordinates the generation of Fast Forward documentation frontpage and related reports.
@@ -62,7 +60,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6260
{
6361
$output->writeln('<info>Generating frontpage for Fast Forward documentation...</info>');
6462

65-
$docsPath = $this->getAbsolutePath('public/docs');
63+
$docsPath = $this->getAbsolutePath('public');
6664
$coveragePath = $this->getAbsolutePath('public/coverage');
6765

6866
$output->writeln('<info>Generating API documentation on path: ' . $docsPath . '</info>');
@@ -75,55 +73,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7573
'--coverage' => $coveragePath,
7674
], $output);
7775

78-
$this->generateFrontpage();
79-
8076
$output->writeln('<info>Frontpage generation completed!</info>');
8177

8278
return self::SUCCESS;
8379
}
84-
85-
/**
86-
* Generates the compiled documentation frontpage correctly.
87-
*
88-
* This method MUST collect the configured render template and write it persistently
89-
* to the `public/index.html` directory.
90-
*
91-
* @return void
92-
*/
93-
private function generateFrontpage(): void
94-
{
95-
$html = $this->renderTemplate(
96-
$this->getProjectDescription(),
97-
[
98-
'Documentation' => './docs/index.html',
99-
'Testdox Report' => './coverage/testdox.html',
100-
'Test Coverage Report' => './coverage/index.html',
101-
]
102-
);
103-
104-
$this->filesystem->dumpFile($this->getAbsolutePath('public/index.html'), $html);
105-
}
106-
107-
/**
108-
* Constructs string variations defining standard components by linking to predefined resources.
109-
*
110-
* The method MUST extract variables correctly and stream the content safely.
111-
* It SHALL strictly return the interpreted string structure.
112-
*
113-
* @param string $title the main title intended for the index interface
114-
* @param array<string, string> $links the associative array representing link titles and their URIs
115-
*
116-
* @return string the evaluated and parsed HTML content
117-
*/
118-
private function renderTemplate(string $title, array $links): string
119-
{
120-
ob_start();
121-
extract([
122-
'title' => $title,
123-
'links' => $links,
124-
]);
125-
include $this->getConfigFile('resources/index.php');
126-
127-
return ob_get_clean();
128-
}
12980
}

tests/Command/ReportsCommandTest.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ protected function getCommandHelp(): string
6666
* @return void
6767
*/
6868
#[Test]
69-
public function executeWillRunDocsAndTestsCommandAndGenerateFrontpage(): void
69+
public function executeWillRunDocsAndTestsCommand(): void
7070
{
7171
$docsCommand = $this->prophesize(Command::class);
7272
$docsCommand->ignoreValidationErrors()
@@ -83,10 +83,6 @@ public function executeWillRunDocsAndTestsCommandAndGenerateFrontpage(): void
8383
$this->application->find('tests')
8484
->willReturn($testsCommand->reveal());
8585

86-
$this->withConfigFile('resources/index.php', true);
87-
88-
$this->filesystem->dumpFile(Argument::type('string'), Argument::type('string'))->shouldBeCalledOnce();
89-
9086
self::assertSame(ReportsCommand::SUCCESS, $this->invokeExecute());
9187
}
9288
}

0 commit comments

Comments
 (0)