@tisuchi This is definitely a step forward, thanks for letting me know. Now the docs assumes that I then call the stub right after declaring it, but it's not my case.
Maybe I wasn't clear, but the call to the class I want mocked is within another class (a Job to be precise), but in my test I want to mock the scraper class so the code can continue executing and my test can find out the final value of the execution.
Basically:
Job.php:
// Returns MyScraper
$scraper = $url->getScraper();
$media = new $scraper($this->article, $url);
$this->result = $media->scrape();
// Here I need $this->result to equal 100 so the code below can keep executing
if($this->result !== 0){...
Test.php:
$mockScraper = $this->createMock(MyScraper::class);
$mockScraper->method('scrape')->willReturn(100);
With that code, the scraper is not mocked in Job.php.