How to samokat method phpunit?

Write phpunit test
I want to make sure that the delete statement returns exactly what I need. The method delete is called by another private method (canDelete) how to write mock for canDelete ?
$data = $service->delete($params);
April 19th 20 at 12:10
1 answer
April 19th 20 at 12:12
Most likely you don't need it, since private methods do not need to Moka, in the General case. Moka methods EXTERNAL dependencies

But if right need, then the current object (the method by which testite inherently) is also creating through the IOC-bilder. That is the test class becomes MOK. And make the method under test with the exception, that is, its Moka Moka do not need and it will work as it is...

Example (do not forget about the AAA methodology):
// Arrange
$provider = $this
 ->setMethodsExcept(['delete']) // these methods will be present here, though the IOC
 ->setConstructorArgs([]) // here based on the constructor to pass
$provider = $provider
 ->method('canDelete') // makeem private method

// Action
$result = $provider->delete();

// Assert
$this->assertEquals(true, $result);

Find more questions by tags PHPUnitPHP