Knp\Bundle\KnpBundlesBundle\Tests\Travis\RepoTest::getBrowserMock PHP Method

getBrowserMock() private method

private getBrowserMock ( $return = [], $with = null )
    private function getBrowserMock($return = array(), $with = null)
    {
        $client = $this->getMockForAbstractClass('Buzz\\Client\\Curl');
        $client->expects($this->any())->method('setVerifyPeer')->with($this->equalTo(false));
        $client->expects($this->any())->method('setTimeout')->with($this->equalTo(30));
        $response = $this->getMock('Buzz\\Message\\Response');
        $response->expects($this->any())->method('getContent')->will($this->returnValue(false !== $with ? json_encode($return) : null));
        $browser = $this->getMock('Buzz\\Browser');
        $browser->expects($this->any())->method('getClient')->will($this->returnValue($client));
        $browser->expects($this->any())->method('setClient')->with($client);
        if (empty($with)) {
            $browser->expects($this->any())->method('get')->will($this->returnValue($response));
        } else {
            $browser->expects($this->any())->method('get')->with($this->equalTo('http://travis-ci.org/' . $with . '.json'))->will($this->returnValue($response));
        }
        return $browser;
    }