Partial Mock in Laravel - method not exists

Viewed 145

I've a class that calls one method from another

class eppConnection()
{
    public function request($xml) 
    {
        $result = $this->makeRequest($xml)
    }

    private function makeRequest($xml) 
    {

    }
}

I want to simulate response from makeRequest and do a partial mock

$mock = $this->partialMock('EppConnection', function (MockInterface $mock) {
            $mock->shouldReceive('sendRequest')`
         ....
}

Next, I make class from DI and call methods

$eppConnection = app()->make('EppConnection');
$requestResult = $eppConnection->sendRequest('text') // This works
$requestResult = $eppConnection->request('text') // This not

method request raises an error Method Mockery_0__EppConnection::request() does not exist on this mock object

I've no idea why, because I do a partial mock, so documentaion says "The methods that are not mocked will be executed normally when called".

Please point me, why it happens and how to fix.

0 Answers
Related