1 | <?php |
||
33 | * Tests for {@see \DoctrineORMModule\Service\MigrationsCommandFactory} |
||
34 | * |
||
35 | * @covers \DoctrineORMModule\Service\MigrationsCommandFactory |
||
36 | */ |
||
37 | class MigrationsCommandFactoryTest extends TestCase |
||
38 | { |
||
39 | private ServiceManager $serviceLocator; |
||
|
|||
40 | |||
41 | protected function setUp() : void |
||
42 | { |
||
43 | $this->serviceLocator = ServiceManagerFactory::getServiceManager(); |
||
44 | } |
||
45 | |||
46 | public function testExecuteFactory() : void |
||
47 | { |
||
48 | $factory = new MigrationsCommandFactory('execute'); |
||
49 | |||
50 | $this->assertInstanceOf( |
||
51 | ExecuteCommand::class, |
||
52 | $factory->createService($this->serviceLocator) |
||
53 | ); |
||
54 | } |
||
55 | |||
56 | public function testDiffFactory() : void |
||
57 | { |
||
58 | $factory = new MigrationsCommandFactory('diff'); |
||
59 | |||
60 | $this->assertInstanceOf( |
||
61 | DiffCommand::class, |
||
62 | $factory->createService($this->serviceLocator) |
||
63 | ); |
||
64 | } |
||
65 | |||
66 | public function testThrowException() : void |
||
67 | { |
||
68 | $factory = new MigrationsCommandFactory('unknowncommand'); |
||
69 | |||
70 | $this->expectException(InvalidArgumentException::class); |
||
71 | $factory->createService($this->serviceLocator); |
||
72 | } |
||
73 | } |
||
74 |