Codeception\Command\Tests\Unit\DbSnapshotTest::it_should_throw_if_pdo_connection_fails PHP Method

it_should_throw_if_pdo_connection_fails() public method

    public function it_should_throw_if_pdo_connection_fails()
    {
        $application = new Application();
        /** @var \tad\WPBrowser\Services\Db\MySQLDumpFactoryInterface $factory */
        $factory = $this->prophesize('\\tad\\WPBrowser\\Services\\Db\\MySQLDumpFactoryInterface');
        $factory->makeDump(Argument::type('string'), Argument::type('string'), Argument::type('string'), Argument::type('string'))->willThrow(new \PDOException());
        $application->add(new DbSnapshot(null, $factory->reveal()));
        $command = $application->find('db:snapshot');
        $commandTester = new CommandTester($command);
        $this->expectException('\\Symfony\\Component\\Console\\Exception\\RuntimeException');
        $commandTester->execute(['command' => $command->getName(), 'name' => 'db', 'snapshot' => 'someSnapshot']);
    }