First set of tests, argument unwrapping/injection
This commit is contained in:
29
tests/CommandTest.php
Normal file
29
tests/CommandTest.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace NoccyLabs\React\CommandBus;
|
||||
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
|
||||
#[CoversClass(Command::class)]
|
||||
class CommandTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
|
||||
public function testCommandName()
|
||||
{
|
||||
$command = new Command("foobar", function () {});
|
||||
|
||||
$this->assertEquals('foobar', $command->getName());
|
||||
}
|
||||
|
||||
public function testCommandExecution()
|
||||
{
|
||||
$hit = false;
|
||||
$command = new Command("foobar", function () use (&$hit) { $hit=true; });
|
||||
$context = new Context("foobar", []);
|
||||
|
||||
$command->call($context);
|
||||
|
||||
$this->assertEquals(true, $hit);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user