Skip to content

Commit

Permalink
workaround PHP sleep() mocking limitation
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Dec 11, 2024
1 parent 62e5acb commit 2ab079f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
19 changes: 19 additions & 0 deletions bootstrap-dev-sleep.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

namespace Malkusch\Lock\Tests;

use phpmock\environment\SleepEnvironmentBuilder;

// workaround https://github.com/php/php-src/issues/17116
(static function () {
$sleepBuilder = new SleepEnvironmentBuilder();
$sleepBuilder->addNamespace('Malkusch\Lock\Mutex');
$sleepBuilder->addNamespace('Malkusch\Lock\Util');
$sleepBuilder->addNamespace('Malkusch\Lock\Tests\Mutex');
$sleepBuilder->addNamespace('Malkusch\Lock\Tests\Util');
$sleep = $sleepBuilder->build();
$sleep->enable();
$sleep->disable();
})();
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@
"autoload-dev": {
"psr-4": {
"Malkusch\\Lock\\Tests\\": "tests/"
}
},
"files": [
"bootstrap-dev-sleep.php"
]
},
"config": {
"allow-plugins": {
Expand Down

0 comments on commit 2ab079f

Please sign in to comment.