Skip to content

Commit d9f4f3a

Browse files
authored
Merge pull request #175 from php-school/increase-coverage
Increase coverage
2 parents 1ed0b2b + 5dd3d6e commit d9f4f3a

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

codecov.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
coverage:
2+
status:
3+
patch:
4+
default:
5+
target: 70%

test/ApplicationTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use PhpSchool\PhpWorkshop\Application;
88
use PHPUnit\Framework\TestCase;
9+
use PhpSchool\PhpWorkshop\Exception\InvalidArgumentException;
910

1011
class ApplicationTest extends TestCase
1112
{
@@ -58,4 +59,30 @@ public function testEventListenersFromLocalAndWorkshopConfigAreMerged(): void
5859
$eventListeners
5960
);
6061
}
62+
63+
public function testExceptionIsThrownIfConfigFileDoesNotExist(): void
64+
{
65+
$this->expectException(InvalidArgumentException::class);
66+
$this->expectExceptionMessage('File "not-existing-file.php" was expected to exist.');
67+
68+
new Application('My workshop', 'not-existing-file.php');
69+
}
70+
71+
public function testExceptionIsThrownIfResultClassDoesNotExist(): void
72+
{
73+
$this->expectException(InvalidArgumentException::class);
74+
$this->expectExceptionMessage('Class "NotExistingClass" does not exist');
75+
76+
$app = new Application('My workshop', __DIR__ . '/../app/config.php');
77+
$app->addResult(\NotExistingClass::class, \NotExistingClass::class);
78+
}
79+
80+
public function testExceptionIsThrownIfResultRendererClassDoesNotExist(): void
81+
{
82+
$this->expectException(InvalidArgumentException::class);
83+
$this->expectExceptionMessage('Class "NotExistingClass" does not exist');
84+
85+
$app = new Application('My workshop', __DIR__ . '/../app/config.php');
86+
$app->addResult(\PhpSchool\PhpWorkshop\Result\Success::class, \NotExistingClass::class);
87+
}
6188
}

0 commit comments

Comments
 (0)