First set of tests, argument unwrapping/injection

This commit is contained in:
2024-03-19 00:01:12 +01:00
parent 74960345ba
commit 35efaa1b0d
11 changed files with 870 additions and 8 deletions

29
tests/CommandTest.php Normal file
View 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);
}
}