-
Notifications
You must be signed in to change notification settings - Fork 42
Omise Unit Tests Clashing With Laravel Unit Tests #110
Copy link
Copy link
Open
Description
Hey all,
To preface, Laravel has phpunit tests built into the framework, where users can write custom tests for various parts of their application. Ideally, I'd like to use my own custom tests with the Omise Test API, but due to the snippet below, any phpunit tests (including Laravel's) are executed with the executeTest() method and return data saved in the tests/fixtures directory.
// OmiseApiResource.php Lines:134-141
protected function execute($url, $requestMethod, $key, $params = null)
{
// If this class is execute by phpunit > get test mode.
if (preg_match('/phpunit/', $_SERVER['SCRIPT_NAME'])) {
$result = $this->_executeTest($url, $requestMethod, $key, $params);
} else {
$result = $this->_executeCurl($url, $requestMethod, $key, $params);
}My current workaround is deleting the contents of the fixtures folder before I run my tests, forcing executeTest to go and retrieve the data from the test API source. Is there any way to override this method? Or maybe a way to localize the preg_match to only the Omise Vendor files?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels