-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2. 增加对非super user的优先级设置抛出错误的忽略
- Loading branch information
Showing
7 changed files
with
561 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- PHPUnit configuration file with new format for PHPUnit 9.3+ --> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" | ||
bootstrap="vendor/autoload.php" | ||
cacheResult="false" | ||
colors="true" | ||
convertDeprecationsToExceptions="true"> | ||
<testsuites> | ||
<testsuite name="process test suite"> | ||
<directory>./tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
<coverage> | ||
<include> | ||
<directory>./src/</directory> | ||
</include> | ||
</coverage> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Tests; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use WorkBunny\Process\Runtime; | ||
|
||
class BaseTestCase extends TestCase | ||
{ | ||
protected ?Runtime $_runtime = null; | ||
|
||
/** | ||
* @return void | ||
*/ | ||
public function setUp(): void | ||
{ | ||
$this->_runtime = new Runtime(); | ||
parent::setUp(); | ||
} | ||
|
||
/** | ||
* @return Runtime|null | ||
*/ | ||
public function runtime(): ?Runtime | ||
{ | ||
return $this->_runtime; | ||
} | ||
|
||
public function write(string $file, string $content) | ||
{ | ||
file_put_contents(__DIR__ . '/cache/' . $file, $content, FILE_APPEND|LOCK_EX); | ||
} | ||
|
||
public function read(string $file) | ||
{ | ||
return file_exists($file = __DIR__ . '/cache/' . $file) ? file_get_contents($file) : ''; | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
public function removeCache(string $file) | ||
{ | ||
if(file_exists($file = __DIR__ . '/cache/' . $file)){ | ||
@unlink($file); | ||
} | ||
} | ||
|
||
public function assertEqualsAndRmCache($expected, $actual, string $file = ''): void | ||
{ | ||
$this->removeCache($file); | ||
$this->assertEquals($expected, $actual); | ||
} | ||
|
||
public function assertContainsHasAndRmCache(array $expected, array $actual, string $file = ''){ | ||
$this->removeCache($file); | ||
|
||
$this->assertCount(count($expected), $actual); | ||
foreach ($expected as $value){ | ||
$this->assertContains($value, $actual); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.