Skip to content

Commit 212fa47

Browse files
Ignore I/O error paths
1 parent e1c6a61 commit 212fa47

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

src/Report/Html/Facade.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,14 @@ private function renderCss(string $target): void
129129

130130
try {
131131
$template->renderTo($this->directory($target . '_css') . 'style.css');
132+
// @codeCoverageIgnoreStart
132133
} catch (Exception $e) {
133134
throw new FileCouldNotBeWrittenException(
134135
$e->getMessage(),
135136
$e->getCode(),
136137
$e,
137138
);
139+
// @codeCoverageIgnoreEnd
138140
}
139141
}
140142

src/Report/Xml/Coverage.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ public function __construct(DOMElement $context, string $line)
3838
public function addTest(string $test): void
3939
{
4040
if ($this->finalized) {
41+
// @codeCoverageIgnoreStart
4142
throw new ReportAlreadyFinalizedException;
43+
// @codeCoverageIgnoreEnd
4244
}
4345

4446
$this->writer->startElement('covered');

src/Report/Xml/Facade.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,15 @@ private function setBuildInformation(): void
9696
private function initTargetDirectory(string $directory): void
9797
{
9898
if (is_file($directory)) {
99+
// @codeCoverageIgnoreStart
99100
if (!is_dir($directory)) {
100101
throw new PathExistsButIsNotDirectoryException($directory);
101102
}
102103

103104
if (!is_writable($directory)) {
104105
throw new WriteOperationFailedException($directory);
105106
}
107+
// @codeCoverageIgnoreEnd
106108
}
107109

108110
DirectoryUtil::createDirectory($directory);
@@ -303,13 +305,15 @@ private function documentAsString(DOMDocument $document): string
303305
$xml = $document->saveXML();
304306

305307
if ($xml === false) {
308+
// @codeCoverageIgnoreStart
306309
$message = 'Unable to generate the XML';
307310

308311
foreach (libxml_get_errors() as $error) {
309312
$message .= PHP_EOL . $error->message;
310313
}
311314

312315
throw new XmlException($message);
316+
// @codeCoverageIgnoreEnd
313317
}
314318

315319
libxml_clear_errors();

0 commit comments

Comments
 (0)