Closed tk26 closed 3 years ago
From Benevity's `@mevans` - "Here's a suggestion for the PHP SDK. `CourierClient` is a final class, which makes it hard to mock using our mocking tools (Mockery). To get around this, I have defined `CourierClientInterface` and a `CourierClientWrapper` that implements the interface. `CourierClientInterface` defines the same `sendNotification` method as `CourierClient`. The wrapper's constructor accepts an instance of `CourierClient` and delegates its implemented `sendNotification` method calls to it. Then I can mock `CourierClientInterface` and create the needed test double without PHP raising errors at me. If instead the SDK provided an interface and the final class implemented it, then SDK consumers could use and mock that interface without the need for the wrapper.Food for thought. I'm not blocked."
Description of the change
Expose CourierClientInterface, which is implemented by CourierClient.
Type of change
Related issues
Checklists
Development
Code review