Open sebastianbergmann opened 1 year ago
@sebastianbergmann Just to check so I don't waste time, is this what you had in mind? If you give me the heads up, I'll move all the phpt files from the generator folder to simple unit tests.
public function testReturnTypeDeclarationsVoid()
{
$generator = new PHPUnit\Framework\MockObject\Generator\Generator;
$mock = $generator->generate(
'Foo2',
true,
[],
'MockFoo'
);
$mock = $this->instantiate($mock->generate());
$mock->expects($this->once())->method('bar')->willReturnCallback(function(string $baz): void {
$this->assertSame('test_foo2', $baz);
});
$this->assertNull($mock->bar('test_foo2'));
$this->assertInstanceOf(Foo2::class, $mock);
$this->assertInstanceOf(MockObjectInternal::class, $mock);
}
Thank you, Marko, for offering to help. But I do not know yet what the right test strategy here is. I also do not know when I will find the time to think about this. Sorry.
We currently have quite a few slow PHPT tests for the test double code generator.
These tests should be migrated from PHPT to regular PHPUnit tests.
This will reduce the time needed to run PHPUnit's test suite and lead to tests that are oblivious to changes in the generated code that do not affect behaviour.