While @BVengerov his answer will definitely work, I suggest a design change instead. I believe bullying chains are not the way to go, but it hurts the readability and, more importantly, the simplicity of your tests.
I suggest you make the class a Findermember of your class. Thus, now you only need to shout out Finder.
class MyClass {
private $finder;
public function __construct(Finder $finder) {
$this->finder = $finder;
}
public function getResults() {
return $this->finder->find($this->DBTable);
}
}
unittesting ( !) .
" $db !" , , , , , . .
, , setFinder(), .