Skip to content

Commit 67eff9b

Browse files
committed
qa: adds tests for InvalidListenerException
Creates InvalidListenerExceptionTest.
1 parent 4cfab08 commit 67eff9b

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
/**
3+
* @see https://github.com/phly/phly-event-dispatcher for the canonical source repository
4+
* @copyright Copyright (c) 2019 Matthew Weier O'Phinney (https:/mwop.net)
5+
* @license https://github.com/phly/phly-event-dispatcher/blob/master/LICENSE.md New BSD License
6+
*/
7+
8+
namespace PhlyTest\EventDispatcher\Exception;
9+
10+
use Phly\EventDispatcher\Exception\InvalidListenerException;
11+
use PHPUnit\Framework\TestCase;
12+
13+
class InvalidListenerExceptionTest extends TestCase
14+
{
15+
public function testForNonCallableService()
16+
{
17+
$instance = InvalidListenerException::forNonCallableService($this);
18+
$this->assertInstanceOf(InvalidListenerException::class, $instance);
19+
$this->assertContains('type "object" is invalid; must be a PHP callable', $instance->getMessage());
20+
}
21+
22+
public function testForNonCallableInstance()
23+
{
24+
$instance = InvalidListenerException::forNonCallableInstance($this);
25+
$this->assertInstanceOf(InvalidListenerException::class, $instance);
26+
$this->assertContains('type "' . __CLASS__ . '" is invalid; must be a callable', $instance->getMessage());
27+
}
28+
}

0 commit comments

Comments
 (0)