Mongolid\Connection\PoolTest::testShouldGetAConnectionFromPoolIfContainsAny PHP Method

testShouldGetAConnectionFromPoolIfContainsAny() public method

    public function testShouldGetAConnectionFromPoolIfContainsAny()
    {
        // Arrange
        $pool = new Pool();
        $connQueue = m::mock();
        $connection = m::mock(Connection::class);
        $this->setProtected($pool, 'connections', $connQueue);
        // Act
        $connQueue->shouldReceive('pop')->once()->andReturn($connection);
        $connQueue->shouldReceive('push')->once()->with($connection);
        // Assert
        $this->assertEquals($connection, $pool->getConnection());
    }