Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
coverage:
status:
patch:
default:
target: 70%
27 changes: 27 additions & 0 deletions test/ApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use PhpSchool\PhpWorkshop\Application;
use PHPUnit\Framework\TestCase;
use PhpSchool\PhpWorkshop\Exception\InvalidArgumentException;

class ApplicationTest extends TestCase
{
Expand Down Expand Up @@ -58,4 +59,30 @@ public function testEventListenersFromLocalAndWorkshopConfigAreMerged(): void
$eventListeners
);
}

public function testExceptionIsThrownIfConfigFileDoesNotExist(): void
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('File "not-existing-file.php" was expected to exist.');

new Application('My workshop', 'not-existing-file.php');
}

public function testExceptionIsThrownIfResultClassDoesNotExist(): void
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Class "NotExistingClass" does not exist');

$app = new Application('My workshop', __DIR__ . '/../app/config.php');
$app->addResult(\NotExistingClass::class, \NotExistingClass::class);
}

public function testExceptionIsThrownIfResultRendererClassDoesNotExist(): void
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Class "NotExistingClass" does not exist');

$app = new Application('My workshop', __DIR__ . '/../app/config.php');
$app->addResult(\PhpSchool\PhpWorkshop\Result\Success::class, \NotExistingClass::class);
}
}