Working a Laravel project that uses PHPUnit\Framework\TestCase class to run unit tests. In order to create mocks it sometimes uses the built in PHPUnit Api. e.g.
$this->mock = $this->getMockBuilder(ClassToMockName::class)
->disableOriginalConstructor()
->onlyMethods(["this", "that", "theOtherMethodName"])
->getMock();
Other times it uses the Mockery library, e.g.
$this->mock = \Mockery::mock(ClassToMock::class)->makePartial();
Are these to methods simply two different ways of making mocks? What are the pros and cons of each?
Could not find much on this topic except for articles like Tips to use for Mockery which don't explain what makes one is preferred over the other.
It may be using Mockery so that static method calls within the method you're testing can be stubbed. PHPUnit does not support this.