-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to mock ext function #815
Comments
the two function seems correct. did you test a simple call to the function to validate that it's this function that are not working? |
The function call is: $result = $action($serviceId->serviceId(), $serviceId->machine());
Source: https://github.com/win32service/service-library/blob/master/lib/Service/ServiceStateManager.php#L89 |
If I replace the line with a switch case, the mock work finely: //$result = $action($serviceId->serviceId(), $serviceId->machine());
switch ($action) {
case 'win32_start_service':
$result = win32_start_service($serviceId->serviceId(), $serviceId->machine());
break;
case 'win32_stop_service':
$result = win32_stop_service($serviceId->serviceId(), $serviceId->machine());
break;
case 'win32_pause_service':
$result = win32_pause_service($serviceId->serviceId(), $serviceId->machine());
break;
case 'win32_continue_service':
$result = win32_continue_service($serviceId->serviceId(), $serviceId->machine());
break;
default:
# code...
break;
} But it's not optimized... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I have written the test for a new library needed mock the function provided by a PHP extension (win32service).
But the mock not work.
PHP 7.3.0 NTS x64
Atoum v3.3
Test file: https://github.com/win32service/service-library/blob/master/tests/Units/Service/ServiceStateManager.php
The result:
https://ci.appveyor.com/project/macintoshplus/win32servicelib/builds/20977270
Link to the library: https://github.com/win32service/service-library/
Can you help me ?
The text was updated successfully, but these errors were encountered: