Skip to content

Commit fa43e67

Browse files
Delete unused code
1 parent cf52ea4 commit fa43e67

10 files changed

+11
-239
lines changed

.psalm/baseline.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -474,9 +474,6 @@
474474
<code><![CDATA[$this->status]]></code>
475475
<code><![CDATA[$this->time]]></code>
476476
</PossiblyNullArgument>
477-
<PropertyTypeCoercion>
478-
<code><![CDATA[$this->testDoubles]]></code>
479-
</PropertyTypeCoercion>
480477
<RedundantCondition>
481478
<code>assert($test instanceof TestMethod)</code>
482479
</RedundantCondition>

src/Logging/TestDox/TestMethod/Subscriber/TestCreatedMockObjectForAbstractClassSubscriber.php

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

src/Logging/TestDox/TestMethod/Subscriber/TestCreatedMockObjectForTraitSubscriber.php

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

src/Logging/TestDox/TestMethod/Subscriber/TestCreatedMockObjectFromWsdlSubscriber.php

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

src/Logging/TestDox/TestMethod/Subscriber/TestCreatedMockObjectSubscriber.php

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

src/Logging/TestDox/TestMethod/Subscriber/TestCreatedPartialMockObjectSubscriber.php

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

src/Logging/TestDox/TestMethod/Subscriber/TestCreatedTestProxySubscriber.php

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

src/Logging/TestDox/TestMethod/Subscriber/TestCreatedTestStubSubscriber.php

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

src/Logging/TestDox/TestMethod/TestResult.php

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,12 @@ final class TestResult
2626
private readonly TestStatus $status;
2727
private readonly ?Throwable $throwable;
2828

29-
/**
30-
* @psalm-var list<class-string|trait-string>
31-
*/
32-
private readonly array $testDoubles;
33-
34-
/**
35-
* @psalm-param list<class-string|trait-string> $testDoubles
36-
*/
37-
public function __construct(TestMethod $test, Duration $duration, TestStatus $status, ?Throwable $throwable, array $testDoubles)
29+
public function __construct(TestMethod $test, Duration $duration, TestStatus $status, ?Throwable $throwable)
3830
{
39-
$this->test = $test;
40-
$this->duration = $duration;
41-
$this->status = $status;
42-
$this->throwable = $throwable;
43-
$this->testDoubles = $testDoubles;
31+
$this->test = $test;
32+
$this->duration = $duration;
33+
$this->status = $status;
34+
$this->throwable = $throwable;
4435
}
4536

4637
public function test(): TestMethod
@@ -70,12 +61,4 @@ public function throwable(): ?Throwable
7061
{
7162
return $this->throwable;
7263
}
73-
74-
/**
75-
* @psalm-return list<class-string|trait-string>
76-
*/
77-
public function testDoubles(): array
78-
{
79-
return $this->testDoubles;
80-
}
8164
}

src/Logging/TestDox/TestMethod/TestResultCollector.php

Lines changed: 6 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,13 @@
2727
use PHPUnit\Event\Test\Failed;
2828
use PHPUnit\Event\Test\Finished;
2929
use PHPUnit\Event\Test\MarkedIncomplete;
30-
use PHPUnit\Event\Test\MockObjectCreated;
31-
use PHPUnit\Event\Test\MockObjectForAbstractClassCreated;
32-
use PHPUnit\Event\Test\MockObjectForTraitCreated;
33-
use PHPUnit\Event\Test\MockObjectFromWsdlCreated;
34-
use PHPUnit\Event\Test\PartialMockObjectCreated;
3530
use PHPUnit\Event\Test\Passed;
3631
use PHPUnit\Event\Test\Prepared;
3732
use PHPUnit\Event\Test\Skipped;
38-
use PHPUnit\Event\Test\TestProxyCreated;
39-
use PHPUnit\Event\Test\TestStubCreated;
4033
use PHPUnit\Event\UnknownSubscriberTypeException;
4134
use PHPUnit\Framework\TestStatus\TestStatus;
4235
use PHPUnit\Logging\TestDox\TestResult as TestDoxTestMethod;
4336
use ReflectionMethod;
44-
use SoapClient;
4537

4638
/**
4739
* @internal This class is not covered by the backward compatibility promise for PHPUnit
@@ -56,11 +48,6 @@ final class TestResultCollector
5648
private ?TestStatus $status = null;
5749
private ?Throwable $throwable = null;
5850

59-
/**
60-
* @psalm-var list<class-string|trait-string>
61-
*/
62-
private array $testDoubles = [];
63-
6451
/**
6552
* @throws EventFacadeIsSealedException
6653
* @throws UnknownSubscriberTypeException
@@ -140,10 +127,9 @@ public function testPrepared(Prepared $event): void
140127
return;
141128
}
142129

143-
$this->time = $event->telemetryInfo()->time();
144-
$this->status = TestStatus::unknown();
145-
$this->throwable = null;
146-
$this->testDoubles = [];
130+
$this->time = $event->telemetryInfo()->time();
131+
$this->status = TestStatus::unknown();
132+
$this->throwable = null;
147133
}
148134

149135
public function testErrored(Errored $event): void
@@ -191,23 +177,6 @@ public function testConsideredRisky(ConsideredRisky $event): void
191177
$this->status = TestStatus::risky($event->message());
192178
}
193179

194-
public function testCreatedTestDouble(MockObjectCreated|MockObjectForAbstractClassCreated|MockObjectForTraitCreated|MockObjectFromWsdlCreated|PartialMockObjectCreated|TestProxyCreated|TestStubCreated $event): void
195-
{
196-
if ($event instanceof MockObjectForTraitCreated) {
197-
$this->testDoubles[] = $event->traitName();
198-
199-
return;
200-
}
201-
202-
if ($event instanceof MockObjectFromWsdlCreated) {
203-
$this->testDoubles[] = SoapClient::class;
204-
205-
return;
206-
}
207-
208-
$this->testDoubles[] = $event->className();
209-
}
210-
211180
/**
212181
* @throws InvalidArgumentException
213182
*/
@@ -230,13 +199,11 @@ public function testFinished(Finished $event): void
230199
$event->telemetryInfo()->time()->duration($this->time),
231200
$this->status,
232201
$this->throwable,
233-
$this->testDoubles,
234202
);
235203

236-
$this->time = null;
237-
$this->status = null;
238-
$this->throwable = null;
239-
$this->testDoubles = [];
204+
$this->time = null;
205+
$this->status = null;
206+
$this->throwable = null;
240207
}
241208

242209
/**
@@ -247,13 +214,6 @@ private function registerSubscribers(Facade $facade): void
247214
{
248215
$facade->registerSubscribers(
249216
new TestConsideredRiskySubscriber($this),
250-
new TestCreatedMockObjectForAbstractClassSubscriber($this),
251-
new TestCreatedMockObjectForTraitSubscriber($this),
252-
new TestCreatedMockObjectFromWsdlSubscriber($this),
253-
new TestCreatedMockObjectSubscriber($this),
254-
new TestCreatedPartialMockObjectSubscriber($this),
255-
new TestCreatedTestProxySubscriber($this),
256-
new TestCreatedTestStubSubscriber($this),
257217
new TestErroredSubscriber($this),
258218
new TestFailedSubscriber($this),
259219
new TestFinishedSubscriber($this),

0 commit comments

Comments
 (0)