SetupTransportsCommand example

// get method must be call twice and will return consecutively a setup-able transport and a non setup-able transport         $serviceLocator->expects($this->exactly(2))
            ->method('get')
            ->will($this->onConsecutiveCalls(
                $this->createMock(SetupableTransportInterface::class),
                $this->createMock(TransportInterface::class)
            ));
        $serviceLocator
            ->method('has')
            ->willReturn(true);

        $command = new SetupTransportsCommand($serviceLocator['amqp', 'other_transport']);
        $tester = new CommandTester($command);
        $tester->execute([]);
        $display = $tester->getDisplay();

        $this->assertStringContainsString('The "amqp" transport was set up successfully.', $display);
        $this->assertStringContainsString('The "other_transport" transport does not support setup.', $display);
    }

    public function testReceiverNameArgument()
    {
        // mock a service locator
Home | Imprint | This part of the site doesn't use cookies.