Open macintoshplus opened 5 years ago
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());
$action
contains the name of function does be call.
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...
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 ?