Skip to content

Commit 6fa53c3

Browse files
* Remove Test\AssertionFailed and Test\AssertionSucceeded events
* Remove Extension\Facade::requireExportOfObjects()
1 parent 6efa643 commit 6fa53c3

File tree

102 files changed

+62
-713
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+62
-713
lines changed

.psalm/baseline.xml

-44
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@
3333
<RedundantCondition>
3434
<code>assert($test instanceof TestMethod)</code>
3535
</RedundantCondition>
36-
<TooManyArguments>
37-
<code>toString</code>
38-
<code>toString</code>
39-
<code>toString</code>
40-
<code>toString</code>
41-
</TooManyArguments>
4236
</file>
4337
<file src="src/Event/Events/Test/HookMethod/AfterLastTestMethodFinished.php">
4438
<PropertyTypeCoercion>
@@ -168,17 +162,6 @@
168162
<code><![CDATA[$e->getCode()]]></code>
169163
</PossiblyInvalidArgument>
170164
</file>
171-
<file src="src/Framework/Constraint/Cardinality/IsEmpty.php">
172-
<TooManyArguments>
173-
<code>toString</code>
174-
</TooManyArguments>
175-
</file>
176-
<file src="src/Framework/Constraint/Constraint.php">
177-
<TooManyArguments>
178-
<code>toString</code>
179-
<code>toString</code>
180-
</TooManyArguments>
181-
</file>
182165
<file src="src/Framework/Constraint/Exception/ExceptionMessageMatchesRegularExpression.php">
183166
<ArgumentTypeCoercion>
184167
<code><![CDATA[$this->regularExpression]]></code>
@@ -188,18 +171,11 @@
188171
<MissingThrowsDocblock>
189172
<code>getMethod</code>
190173
</MissingThrowsDocblock>
191-
<TooManyArguments>
192-
<code>toString</code>
193-
</TooManyArguments>
194174
</file>
195175
<file src="src/Framework/Constraint/Object/ObjectHasProperty.php">
196176
<MissingThrowsDocblock>
197177
<code>hasProperty</code>
198178
</MissingThrowsDocblock>
199-
<TooManyArguments>
200-
<code>toString</code>
201-
<code>toString</code>
202-
</TooManyArguments>
203179
</file>
204180
<file src="src/Framework/Constraint/Operator/BinaryOperator.php">
205181
<PropertyTypeCoercion>
@@ -219,11 +195,6 @@
219195
<code><![CDATA[$this->pattern]]></code>
220196
</ArgumentTypeCoercion>
221197
</file>
222-
<file src="src/Framework/Constraint/String/StringContains.php">
223-
<TooManyArguments>
224-
<code>toString</code>
225-
</TooManyArguments>
226-
</file>
227198
<file src="src/Framework/Constraint/String/StringMatchesFormatDescription.php">
228199
<ArgumentTypeCoercion>
229200
<code>$line</code>
@@ -232,26 +203,11 @@
232203
)]]></code>
233204
</ArgumentTypeCoercion>
234205
</file>
235-
<file src="src/Framework/Constraint/Traversable/ArrayHasKey.php">
236-
<TooManyArguments>
237-
<code>toString</code>
238-
</TooManyArguments>
239-
</file>
240-
<file src="src/Framework/Constraint/Traversable/IsList.php">
241-
<TooManyArguments>
242-
<code>toString</code>
243-
</TooManyArguments>
244-
</file>
245206
<file src="src/Framework/Constraint/Traversable/TraversableContainsOnly.php">
246207
<ArgumentTypeCoercion>
247208
<code>$type</code>
248209
</ArgumentTypeCoercion>
249210
</file>
250-
<file src="src/Framework/Constraint/Type/IsInstanceOf.php">
251-
<TooManyArguments>
252-
<code>toString</code>
253-
</TooManyArguments>
254-
</file>
255211
<file src="src/Framework/DataProviderTestSuite.php">
256212
<ArgumentTypeCoercion>
257213
<code>$className</code>

src/Event/Emitter/DispatchingEmitter.php

+2-48
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@
2525
use PHPUnit\Event\TestSuite\Sorted as TestSuiteSorted;
2626
use PHPUnit\Event\TestSuite\Started as TestSuiteStarted;
2727
use PHPUnit\Event\TestSuite\TestSuite;
28-
use PHPUnit\Framework\Constraint;
2928
use PHPUnit\TextUI\Configuration\Configuration;
30-
use PHPUnit\Util\Exporter;
29+
use SebastianBergmann\Exporter\Exporter;
3130

3231
/**
3332
* @internal This class is not covered by the backward compatibility promise for PHPUnit
@@ -38,7 +37,6 @@ final class DispatchingEmitter implements Emitter
3837
private readonly Telemetry\System $system;
3938
private readonly Telemetry\Snapshot $startSnapshot;
4039
private Telemetry\Snapshot $previousSnapshot;
41-
private bool $exportObjects = false;
4240

4341
public function __construct(Dispatcher $dispatcher, Telemetry\System $system)
4442
{
@@ -49,16 +47,6 @@ public function __construct(Dispatcher $dispatcher, Telemetry\System $system)
4947
$this->previousSnapshot = $system->snapshot();
5048
}
5149

52-
public function exportObjects(): void
53-
{
54-
$this->exportObjects = true;
55-
}
56-
57-
public function exportsObjects(): bool
58-
{
59-
return $this->exportObjects;
60-
}
61-
6250
/**
6351
* @throws InvalidArgumentException
6452
* @throws UnknownEventTypeException
@@ -478,40 +466,6 @@ public function testRegisteredComparator(string $className): void
478466
);
479467
}
480468

481-
/**
482-
* @throws InvalidArgumentException
483-
* @throws UnknownEventTypeException
484-
*/
485-
public function testAssertionSucceeded(mixed $value, Constraint\Constraint $constraint, string $message): void
486-
{
487-
$this->dispatcher->dispatch(
488-
new Test\AssertionSucceeded(
489-
$this->telemetryInfo(),
490-
Exporter::export($value, $this->exportObjects),
491-
$constraint->toString($this->exportObjects),
492-
$constraint->count(),
493-
$message,
494-
),
495-
);
496-
}
497-
498-
/**
499-
* @throws InvalidArgumentException
500-
* @throws UnknownEventTypeException
501-
*/
502-
public function testAssertionFailed(mixed $value, Constraint\Constraint $constraint, string $message): void
503-
{
504-
$this->dispatcher->dispatch(
505-
new Test\AssertionFailed(
506-
$this->telemetryInfo(),
507-
Exporter::export($value, $this->exportObjects),
508-
$constraint->toString($this->exportObjects),
509-
$constraint->count(),
510-
$message,
511-
),
512-
);
513-
}
514-
515469
/**
516470
* @psalm-param class-string $className
517471
*
@@ -627,7 +581,7 @@ public function testCreatedTestProxy(string $className, array $constructorArgume
627581
new Test\TestProxyCreated(
628582
$this->telemetryInfo(),
629583
$className,
630-
Exporter::export($constructorArguments, $this->exportObjects),
584+
(new Exporter)->export($constructorArguments),
631585
),
632586
);
633587
}

src/Event/Emitter/Emitter.php

-9
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,13 @@
1313
use PHPUnit\Event\Code\ComparisonFailure;
1414
use PHPUnit\Event\Code\Throwable;
1515
use PHPUnit\Event\TestSuite\TestSuite;
16-
use PHPUnit\Framework\Constraint;
1716
use PHPUnit\TextUI\Configuration\Configuration;
1817

1918
/**
2019
* @internal This class is not covered by the backward compatibility promise for PHPUnit
2120
*/
2221
interface Emitter
2322
{
24-
public function exportObjects(): void;
25-
26-
public function exportsObjects(): bool;
27-
2823
public function applicationStarted(): void;
2924

3025
public function testRunnerStarted(): void;
@@ -109,10 +104,6 @@ public function testPrepared(Code\Test $test): void;
109104
*/
110105
public function testRegisteredComparator(string $className): void;
111106

112-
public function testAssertionSucceeded(mixed $value, Constraint\Constraint $constraint, string $message): void;
113-
114-
public function testAssertionFailed(mixed $value, Constraint\Constraint $constraint, string $message): void;
115-
116107
/**
117108
* @psalm-param class-string $className
118109
*/

src/Event/Events/Test/Assertion/AssertionFailed.php

-74
This file was deleted.

src/Event/Events/Test/Assertion/AssertionFailedSubscriber.php

-20
This file was deleted.

src/Event/Events/Test/Assertion/AssertionSucceeded.php

-74
This file was deleted.

src/Event/Events/Test/Assertion/AssertionSucceededSubscriber.php

-20
This file was deleted.

0 commit comments

Comments
 (0)