bigcommerce / bigcommerce-api-php

Connect PHP applications with the Bigcommerce Platform
https://developer.bigcommerce.com
MIT License
143 stars 186 forks source link

Implement connection interface for mocking data #277

Open furang opened 2 years ago

furang commented 2 years ago

What?

This request implement ConnectionInterface. I think this is very useful so now you can create custom connection service and mock necessary responses without even having developer account. You just have to create a Client instance and set custom Connection service with setConnection

use Bigcommerce\Api\Client as Bigcommerce;

...

$customConnection = new ConnectionMock();

...

Bigcommerce::configure($creds);
Bigcommerce::setConnection($customConnection);

After that you can use any bundle methods and receive responses mocked in custom ConnectionMock class.