Contao\CoreBundle\Test\EventListener\CommandSchedulerListenerTest::mockConnection PHP Method

mockConnection() private method

Mocks a database connection object.
private mockConnection ( ) : Doctrine\DBAL\Connection | PHPUnit_Framework_MockObject_MockObject
return Doctrine\DBAL\Connection | PHPUnit_Framework_MockObject_MockObject
    private function mockConnection()
    {
        $schemaManager = $this->getMock('Doctrine\\DBAL\\Schema\\MySqlSchemaManager', ['tablesExist'], [], '', false);
        $schemaManager->expects($this->any())->method('tablesExist')->willReturn(true);
        $connection = $this->getMock('Doctrine\\DBAL\\Connection', ['getSchemaManager'], [], '', false);
        $connection->expects($this->any())->method('getSchemaManager')->willReturn($schemaManager);
        return $connection;
    }