factory = new ApplicationFactory(); } /** @test */ public function allCommandsWhichAreServicesAreAdded(): void { $sm = $this->createServiceManager([ 'commands' => [ 'foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz', ], ]); $sm->setService('foo', $this->createCommandMock('foo')->reveal()); $sm->setService('bar', $this->createCommandMock('bar')->reveal()); $instance = ($this->factory)($sm); self::assertTrue($instance->has('foo')); self::assertTrue($instance->has('bar')); self::assertFalse($instance->has('baz')); } private function createServiceManager(array $config = []): ServiceManager { return new ServiceManager(['services' => [ 'config' => [ 'cli' => $config, ], AppOptions::class => new AppOptions(), ]]); } }