When I use expect(RectangleBuilder::class)->toExtend(ShapeBuilder::class);
it returns true, when the class for RectangleBuilder does not yet exist. Upon creating a plain class for RectangleBuilder (without the extends clause) it will now return false.
In my tracing, in the Pest\Expectation class' toExtend method, none of its callbacks are invoked when the class doesn't exist. But, they are called if the class does exist.
How to Reproduce
Existing code:
namespace Builders;
abstract class ShapeBuilder { }
Test:
use Builders\RectangleBuilder; // Exists
use Builders\ShapeBuilder; // File and class do NOT EXIST yet
test('rectangle builder extends shape builder', function () {
expect(RectangleBuilder::class)->toExtend(ShapeBuilder::class); // True
expect("")->toExtend(ShapeBuilder::class); // True
})->only();
What Happened
When I use expect(RectangleBuilder::class)->toExtend(ShapeBuilder::class);
it returns true, when the class for RectangleBuilder does not yet exist. Upon creating a plain class for RectangleBuilder (without the extends clause) it will now return false.
In my tracing, in the Pest\Expectation class' toExtend method, none of its callbacks are invoked when the class doesn't exist. But, they are called if the class does exist.
How to Reproduce
Existing code:
Test:
Sample Repository
No response
Pest Version
2.30.0
PHP Version
8.1.2
Operation System
Windows
Notes
No response