|
| 1 | +<?php declare(strict_types=1); |
| 2 | + |
| 3 | +namespace ApiClients\Tests\Foundation; |
| 4 | + |
| 5 | +use ApiClients\Foundation\CommandLocatorEvent; |
| 6 | +use ApiClients\Tools\TestUtilities\TestCase; |
| 7 | + |
| 8 | +final class CommandLocatorEventTest extends TestCase |
| 9 | +{ |
| 10 | + public function testName() |
| 11 | + { |
| 12 | + $this->assertSame(CommandLocatorEvent::NAME, CommandLocatorEvent::create()->getName()); |
| 13 | + } |
| 14 | + |
| 15 | + public function testEvent() |
| 16 | + { |
| 17 | + $event = CommandLocatorEvent::create(); |
| 18 | + |
| 19 | + $this->assertSame([], $event->getMap()); |
| 20 | + |
| 21 | + $event->add( |
| 22 | + dirname(__DIR__) . DIRECTORY_SEPARATOR . 'test_app' . DIRECTORY_SEPARATOR . 'CommandBus', |
| 23 | + 'ApiClients\TestApp\Foundation\CommandBus' |
| 24 | + ); |
| 25 | + $this->assertSame([ |
| 26 | + 'ApiClients\TestApp\Foundation\CommandBus\Command' => 'ApiClients\TestApp\Foundation\CommandBus\Handler', |
| 27 | + ], $event->getMap()); |
| 28 | + |
| 29 | + $event->add( |
| 30 | + dirname(__DIR__) . DIRECTORY_SEPARATOR . 'test_app' . DIRECTORY_SEPARATOR . 'CommandTruck', |
| 31 | + 'ApiClients\TestApp\Foundation\CommandTruck' |
| 32 | + ); |
| 33 | + $this->assertSame([ |
| 34 | + 'ApiClients\TestApp\Foundation\CommandBus\Command' => 'ApiClients\TestApp\Foundation\CommandBus\Handler', |
| 35 | + 'ApiClients\TestApp\Foundation\CommandTruck\Command' => 'ApiClients\TestApp\Foundation\CommandTruck\Handler', |
| 36 | + ], $event->getMap()); |
| 37 | + |
| 38 | + $event->add( |
| 39 | + dirname(__DIR__) . DIRECTORY_SEPARATOR . 'test_app' . DIRECTORY_SEPARATOR . 'CommandPlane', |
| 40 | + 'ApiClients\TestApp\Foundation\CommandPlane' |
| 41 | + ); |
| 42 | + $this->assertSame([ |
| 43 | + 'ApiClients\TestApp\Foundation\CommandBus\Command' => 'ApiClients\TestApp\Foundation\CommandBus\Handler', |
| 44 | + 'ApiClients\TestApp\Foundation\CommandTruck\Command' => 'ApiClients\TestApp\Foundation\CommandTruck\Handler', |
| 45 | + 'ApiClients\TestApp\Foundation\CommandPlane\Command' => 'ApiClients\TestApp\Foundation\CommandPlane\Handler', |
| 46 | + ], $event->getMap()); |
| 47 | + |
| 48 | + $event->add( |
| 49 | + dirname(__DIR__) . DIRECTORY_SEPARATOR . 'test_app' . DIRECTORY_SEPARATOR . 'CommandSubmarine', |
| 50 | + 'ApiClients\TestApp\Foundation\CommandSubmarine' |
| 51 | + ); |
| 52 | + $this->assertSame([ |
| 53 | + 'ApiClients\TestApp\Foundation\CommandBus\Command' => 'ApiClients\TestApp\Foundation\CommandBus\Handler', |
| 54 | + 'ApiClients\TestApp\Foundation\CommandTruck\Command' => 'ApiClients\TestApp\Foundation\CommandTruck\Handler', |
| 55 | + 'ApiClients\TestApp\Foundation\CommandPlane\Command' => 'ApiClients\TestApp\Foundation\CommandPlane\Handler', |
| 56 | + 'ApiClients\TestApp\Foundation\CommandSubmarine\Command' => 'ApiClients\TestApp\Foundation\CommandSubmarine\Handler', |
| 57 | + ], $event->getMap()); |
| 58 | + |
| 59 | + } |
| 60 | +} |
0 commit comments