so what you want, called "Mocking" and this will not work with a simple function.
to make it simple.(code is not tested)
class MySpecialClass
{
 public function doSomeSpecialThings(){
  $response = $this->doFancySQL();
  return $response;
 }
}
so if you want to manipulate the method call, you have to extract it to an external class and inject it 
class MySpecialClass
{
  public function setFancySqlInterface(FancySqlInterface $fancySqlInterface){
 $this->fancySqlInterface = $fancySqlInterface;
 }
 public function doSomeSpecialThings(){
  $response = $this->fancySqlInterface->doFancySQL();
  return $response;
 }
}
with this, now you can use the method setFancySqlInterface in your test with a fake class which returns a specific response.
you can either create a fake class or use a "Mocking Framework" for this task
as an example, you can see here 
https://github.com/BlackScorp/guestbook/blob/master/tests/UseCase/ListEntriesTest.php#L35  that i created fake entities and added them to an Fake repository https://github.com/BlackScorp/guestbook/blob/master/tests/UseCase/ListEntriesTest.php#L70 
hope you understand what i mean :D