Skip to content
This repository was archived by the owner on Nov 5, 2025. It is now read-only.

Commit f2dc5a2

Browse files
Do not generate Markdown
1 parent 68806f4 commit f2dc5a2

File tree

3 files changed

+10
-94
lines changed

3 files changed

+10
-94
lines changed

tests/src/EventTestCase.php

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?php declare(strict_types=1);
22
namespace example\framework\event;
33

4-
use const PHP_EOL;
54
use function array_keys;
65
use function array_values;
76
use function assert;
@@ -136,7 +135,6 @@ final protected function then(Event ...$events): void
136135
$this->then[] = $event->asString();
137136
}
138137

139-
$this->provideMarkdown();
140138
$this->provideGraphViz();
141139
}
142140

@@ -195,28 +193,6 @@ private function assertEventObjectsAreEqualExceptForUuid(Event $expected, Event
195193
);
196194
}
197195

198-
private function provideMarkdown(): void
199-
{
200-
$buffer = 'Given:' . PHP_EOL . PHP_EOL;
201-
202-
foreach ($this->given as $given) {
203-
$buffer .= ' - ' . $given . PHP_EOL;
204-
}
205-
206-
$buffer .= PHP_EOL;
207-
208-
$buffer .= 'When:' . PHP_EOL . PHP_EOL;
209-
$buffer .= ' - ' . $this->when . PHP_EOL . PHP_EOL;
210-
211-
$buffer .= 'Then:' . PHP_EOL . PHP_EOL;
212-
213-
foreach ($this->then as $then) {
214-
$buffer .= ' - ' . $then . PHP_EOL;
215-
}
216-
217-
$this->provideAdditionalInformation($buffer);
218-
}
219-
220196
private function provideGraphViz(): void
221197
{
222198
$edges = [];

tests/src/extension/Extension.php

Lines changed: 10 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@
22
namespace example\framework\event\test\extension;
33

44
use const DIRECTORY_SEPARATOR;
5-
use const PHP_EOL;
65
use function assert;
76
use function file_put_contents;
87
use function is_dir;
9-
use function ksort;
108
use function mkdir;
119
use function sprintf;
1210
use function str_replace;
13-
use function str_starts_with;
1411
use PHPUnit\Event\Test\AdditionalInformationProvided;
1512
use PHPUnit\Runner\Extension\Extension as ExtensionInterface;
1613
use PHPUnit\Runner\Extension\Facade as ExtensionFacade;
@@ -24,11 +21,6 @@ final class Extension implements ExtensionInterface
2421
*/
2522
private string $targetDirectory;
2623

27-
/**
28-
* @var array<string, list<array{testdox: string, specification: string}>>
29-
*/
30-
private array $specification = [];
31-
3224
public function bootstrap(Configuration $configuration, ExtensionFacade $facade, ParameterCollection $parameters): void
3325
{
3426
$targetDirectory = '/tmp';
@@ -43,54 +35,20 @@ public function bootstrap(Configuration $configuration, ExtensionFacade $facade,
4335

4436
$this->createDirectory($this->targetDirectory);
4537

46-
$facade->registerSubscribers(
47-
new AdditionalInformationProvidedSubscriber($this),
48-
new TestRunnerExecutionFinishedSubscriber($this),
49-
);
38+
$facade->registerSubscriber(new AdditionalInformationProvidedSubscriber($this));
5039
}
5140

5241
public function testProvidedAdditionalInformation(AdditionalInformationProvided $event): void
5342
{
54-
if (str_starts_with($event->additionalInformation(), 'strict digraph G {')) {
55-
file_put_contents(
56-
sprintf(
57-
'%s%s%s.dot',
58-
$this->targetDirectory,
59-
DIRECTORY_SEPARATOR,
60-
str_replace(['\\', '::'], '_', $event->test()->id()),
61-
),
62-
$event->additionalInformation(),
63-
);
64-
65-
return;
66-
}
67-
68-
if (!isset($this->specification[$event->test()->testDox()->prettifiedClassName()])) {
69-
$this->specification[$event->test()->testDox()->prettifiedClassName()] = [];
70-
}
71-
72-
$this->specification[$event->test()->testDox()->prettifiedClassName()][] = [
73-
'testdox' => $event->test()->testDox()->prettifiedMethodName(),
74-
'specification' => $event->additionalInformation(),
75-
];
76-
}
77-
78-
public function flush(): void
79-
{
80-
ksort($this->specification);
81-
82-
$buffer = '';
83-
84-
foreach ($this->specification as $class => $methods) {
85-
$buffer .= '# ' . $class . PHP_EOL . PHP_EOL;
86-
87-
foreach ($methods as $method) {
88-
$buffer .= '## ' . $method['testdox'] . PHP_EOL . PHP_EOL;
89-
$buffer .= $method['specification'] . PHP_EOL . PHP_EOL;
90-
}
91-
}
92-
93-
file_put_contents($this->targetDirectory . DIRECTORY_SEPARATOR . 'events.md', $buffer);
43+
file_put_contents(
44+
sprintf(
45+
'%s%s%s.dot',
46+
$this->targetDirectory,
47+
DIRECTORY_SEPARATOR,
48+
str_replace(['\\', '::'], '_', $event->test()->id()),
49+
),
50+
$event->additionalInformation(),
51+
);
9452
}
9553

9654
/**

tests/src/extension/TestRunnerExecutionFinishedSubscriber.php

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

0 commit comments

Comments
 (0)