Skip to content

Commit 1e4641d

Browse files
Refactor
1 parent 254085f commit 1e4641d

File tree

7 files changed

+12
-38
lines changed

7 files changed

+12
-38
lines changed

.psalm/baseline.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,8 @@
910910
<code><![CDATA[logEventsVerboseText]]></code>
911911
<code><![CDATA[logEventsVerboseText]]></code>
912912
<code><![CDATA[logfileJunit]]></code>
913+
<code><![CDATA[logfileJunit]]></code>
914+
<code><![CDATA[logfileTeamcity]]></code>
913915
<code><![CDATA[logfileTeamcity]]></code>
914916
</MissingThrowsDocblock>
915917
<UnresolvableInclude>

src/Runner/Exception/DirectoryCannotBeCreatedException.php

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

src/TextUI/Exception/DirectoryDoesNotExistException.php renamed to src/Runner/Exception/DirectoryDoesNotExistException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
99
*/
10-
namespace PHPUnit\TextUI;
10+
namespace PHPUnit\Runner;
1111

1212
use function sprintf;
1313
use RuntimeException;

src/Runner/ResultCache/DefaultResultCache.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
use function json_decode;
2222
use function json_encode;
2323
use PHPUnit\Framework\TestStatus\TestStatus;
24-
use PHPUnit\Runner\DirectoryCannotBeCreatedException;
24+
use PHPUnit\Runner\DirectoryDoesNotExistException;
2525
use PHPUnit\Runner\Exception;
2626
use PHPUnit\Util\Filesystem;
2727

@@ -130,7 +130,7 @@ public function load(): void
130130
public function persist(): void
131131
{
132132
if (!Filesystem::createDirectory(dirname($this->cacheFilename))) {
133-
throw new DirectoryCannotBeCreatedException($this->cacheFilename);
133+
throw new DirectoryDoesNotExistException(dirname($this->cacheFilename));
134134
}
135135

136136
$data = [

src/TextUI/Application.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
use PHPUnit\Runner\Baseline\Reader;
3434
use PHPUnit\Runner\Baseline\Writer;
3535
use PHPUnit\Runner\CodeCoverage;
36+
use PHPUnit\Runner\DirectoryDoesNotExistException;
3637
use PHPUnit\Runner\ErrorHandler;
3738
use PHPUnit\Runner\Extension\ExtensionBootstrapper;
3839
use PHPUnit\Runner\Extension\Facade as ExtensionFacade;
@@ -215,7 +216,7 @@ public function run(array $argv): int
215216
OutputFacade::printerFor($configuration->logfileTestdoxHtml())->print(
216217
(new TestDoxHtmlRenderer)->render($testDoxResult),
217218
);
218-
} catch (Exception $e) {
219+
} catch (DirectoryDoesNotExistException|InvalidSocketException $e) {
219220
EventFacade::emitter()->testRunnerTriggeredWarning(
220221
sprintf(
221222
'Cannot log test results in TestDox HTML format to "%s": %s',
@@ -232,7 +233,7 @@ public function run(array $argv): int
232233
OutputFacade::printerFor($configuration->logfileTestdoxText())->print(
233234
(new TestDoxTextRenderer)->render($testDoxResult),
234235
);
235-
} catch (Exception $e) {
236+
} catch (DirectoryDoesNotExistException|InvalidSocketException $e) {
236237
EventFacade::emitter()->testRunnerTriggeredWarning(
237238
sprintf(
238239
'Cannot log test results in TestDox plain text format to "%s": %s',
@@ -570,7 +571,7 @@ private function registerLogfileWriters(Configuration $configuration): void
570571
OutputFacade::printerFor($configuration->logfileJunit()),
571572
EventFacade::instance(),
572573
);
573-
} catch (Exception $e) {
574+
} catch (DirectoryDoesNotExistException|InvalidSocketException $e) {
574575
EventFacade::emitter()->testRunnerTriggeredWarning(
575576
sprintf(
576577
'Cannot log test results in JUnit XML format to "%s": %s',
@@ -589,7 +590,7 @@ private function registerLogfileWriters(Configuration $configuration): void
589590
),
590591
EventFacade::instance(),
591592
);
592-
} catch (Exception $e) {
593+
} catch (DirectoryDoesNotExistException|InvalidSocketException $e) {
593594
EventFacade::emitter()->testRunnerTriggeredWarning(
594595
sprintf(
595596
'Cannot log test results in TeamCity format to "%s": %s',

src/TextUI/Output/Facade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
use PHPUnit\Event\UnknownSubscriberTypeException;
1616
use PHPUnit\Logging\TeamCity\TeamCityLogger;
1717
use PHPUnit\Logging\TestDox\TestResultCollection;
18+
use PHPUnit\Runner\DirectoryDoesNotExistException;
1819
use PHPUnit\TestRunner\TestResult\TestResult;
1920
use PHPUnit\TextUI\Configuration\Configuration;
20-
use PHPUnit\TextUI\DirectoryDoesNotExistException;
2121
use PHPUnit\TextUI\InvalidSocketException;
2222
use PHPUnit\TextUI\Output\Default\ProgressPrinter\ProgressPrinter as DefaultProgressPrinter;
2323
use PHPUnit\TextUI\Output\Default\ResultPrinter as DefaultResultPrinter;

src/TextUI/Output/Printer/DefaultPrinter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use function fwrite;
2020
use function str_replace;
2121
use function str_starts_with;
22-
use PHPUnit\TextUI\DirectoryDoesNotExistException;
22+
use PHPUnit\Runner\DirectoryDoesNotExistException;
2323
use PHPUnit\TextUI\InvalidSocketException;
2424
use PHPUnit\Util\Filesystem;
2525

0 commit comments

Comments
 (0)