public function testNewInstanceWithoutConstructor() { $classMock = new ClassMock(); $constructorRun = false; $classMock->mockMethod('__construct')->set(function () use(&$constructorRun) { $constructorRun = true; }); $classMock->newInstanceWithoutConstructor(); $this->assertFalse($constructorRun); $classMock->newInstance(); $this->assertTrue($constructorRun); }