I have a PhpUnit test class like this:
use PHPUnit\Framework\TestCase;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
final class SheetValidationTest extends TestCase {
private function isTitleValid(string $title) {
$worksheetStub = $this->createStub(Worksheet::class);
$worksheetStub->method('getTitle')->willReturn($title);
[ // ... act and assertion here ]
}
}
When I run this test, I get:
Cannot stub or mock class or interface "PhpOffice\PhpSpreadsheet\Worksheet\Worksheet" which does not exist
The Worksheet class is present (in vendor) and Ctrl+Click
takes me to that very class.
The actual code where that class is used works fine.
A Google search and SO search did not help me to solve this problem; anybody got an idea?
Should I use the MockBuilder, instead? Thanks, folks!