Really unsure if this is possible but better to ask. I am wanting to test that a file is wrtten to the filesystem and using mockery to determine whether this the case. if the test fails, the file is physically written to the disk but if it passes, it isn't. I understand why this is but wondered if there was a way to tell Mockery "If this fails, don't perform the action". My code:
I was hoping the inclusion of once may tell mockery "okay, well we're only expecting this one time, so it either passes or fails - we are not expecting a different call to put.
The example above is simple but the application I am working on is a bit more complex and it becomes tiresome having to go and remove the erroneous file if the test fails.
I've not tried this as it doesn't make a lot of sense. Calling $mock->shouldReceive('put') with incorrect args will cause the file to be written. ->returnUsing(...) would just write the file again if $shouldWriteToFile is true? And where does $testPassed come from??
EDIT: Reply to "LarryAI" but response disappeared when marked as unhelpful.