6

I want use Mockery and change this:

$mockFoo = $this->getMockBuilder('Foo')
        ->disableOriginalConstructor()
        ->getMock();

to this:

$mockFoo = m::mock('Foo');

But I don't know how disable original constructor in Mockery. Please help me if You can. :-)

Marcin Zaremba
  • 253
  • 1
  • 3
  • 11

1 Answers1

8

Mockery does not call constructor if no parameters are specified:

\Mockery::mock('Foo');
user487772
  • 8,800
  • 5
  • 47
  • 72
  • It worked in earlier versions of Mockery. In 2023 use partial doubles for that https://docs.mockery.io/en/latest/cookbook/not_calling_the_constructor.html – northerner Sep 01 '23 at 13:43