Skip to content

Commit 9672ece

Browse files
committed
Test MISC
1 parent d026216 commit 9672ece

File tree

5 files changed

+51
-55
lines changed

5 files changed

+51
-55
lines changed

packages/cache/src/Storage/FileStorage.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,11 @@ protected function checkFilePath(string $filePath): bool
165165
{
166166
if (!is_dir($filePath)) {
167167
try {
168-
mkdir($filePath, 0755, true);
168+
if (!mkdir($filePath, 0755, true) && !is_dir($filePath)) {
169+
throw new \RuntimeException(sprintf('Directory "%s" was not created', $filePath));
170+
}
169171
} catch (Throwable $e) {
170-
throw new RuntimeException(
171-
sprintf('Directory "%s" was not created with error: %s', $filePath, $e->getMessage()),
172-
$e->getCode(),
173-
$e
174-
);
172+
throw new RuntimeException($e->getMessage(), $e->getCode(), $e);
175173
}
176174
}
177175

packages/http/test/Transport/AbstractTransportTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ protected function getHost(): string
289289
/**
290290
* @inheritDoc
291291
*/
292-
protected function runTest()
292+
protected function runTest(): mixed
293293
{
294294
try {
295295
return parent::runTest();

packages/orm/src/ORM.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,12 @@ public function hydrateEntity(array $data, object $entity): object
287287
}
288288

289289
/**
290-
* @template T
290+
* @template E
291291
*
292-
* @param string|T $entityClass
293-
* @param array|object $data
292+
* @param class-string<E> $entityClass
293+
* @param array|object $data
294294
*
295-
* @return object|T
295+
* @return E
296296
*
297297
* @throws ReflectionException
298298
*/

phpunit.ci.xml

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,40 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit bootstrap="vendor/autoload.php"
3-
convertErrorsToExceptions="true"
4-
convertNoticesToExceptions="true"
5-
convertWarningsToExceptions="true">
6-
<php>
7-
<ini name="error_reporting" value="-1" />
8-
9-
<const name="WINDWALKER_TEST_HTTP_URL" value="http://localhost:8100" />
10-
11-
<const name="WINDWALKER_TEST_DB_DSN_MYSQL" value="host=127.0.0.1;dbname=windwalker_test;user=root;password=ut1234;prefix=ww_" />
12-
<const name="WINDWALKER_TEST_DB_DSN_POSTGRESQL" value="host=127.0.0.1;dbname=windwalker_test;user=postgres;password=ut1234;prefix=ww_" />
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
bootstrap="vendor/autoload.php"
5+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd"
6+
cacheDirectory=".phpunit.cache">
7+
<coverage/>
8+
<php>
9+
<ini name="error_reporting" value="-1"/>
10+
<const name="WINDWALKER_TEST_HTTP_URL" value="http://localhost:8100"/>
11+
<const name="WINDWALKER_TEST_DB_DSN_MYSQL"
12+
value="host=127.0.0.1;dbname=windwalker_test;user=root;password=ut1234;prefix=ww_"/>
13+
<const name="WINDWALKER_TEST_DB_DSN_POSTGRESQL"
14+
value="host=127.0.0.1;dbname=windwalker_test;user=postgres;password=ut1234;prefix=ww_"/>
1315
<!--<const name="WINDWALKER_TEST_DB_DSN_ORACLE" value="host=localhost;port=5432;dbname=windwalker_test;user=root;password=ut1234;prefix=ww_" />-->
1416
<!--<const name="WINDWALKER_TEST_DB_DSN_SQLSERVER" value="host=localhost;port=1521;dbname=windwalker_test;user=root;password=ut1234;prefix=ww_" />-->
15-
<const name="WINDWALKER_TEST_DB_DSN_SQLITE" value="dbname=tmp/test.db;prefix=ww_" />
16-
17-
<env name="REDIS_ENABLED" value="1" />
18-
<env name="MEMCACHED_ENABLED" value="1" />
19-
<env name="SWOOLE_ENABLED" value="1" />
20-
</php>
21-
<testsuites>
22-
<testsuite name="Unit">
23-
<directory>packages/*/test</directory>
24-
</testsuite>
25-
</testsuites>
26-
27-
<filter>
28-
<whitelist processUncoveredFilesFromWhitelist="true">
29-
<directory suffix=".php">packages</directory>
30-
<exclude>
31-
<directory suffix=".php">packages/*/test</directory>
32-
<directory suffix=".php">packages/*/.ide</directory>
33-
<directory suffix=".php">packages/*/resources</directory>
34-
</exclude>
35-
</whitelist>
36-
</filter>
37-
38-
<!-- <logging>-->
39-
<!-- <log type="coverage-text" target="php://stdout" showUncoveredFiles="false"/>-->
40-
<!-- </logging>-->
17+
<const name="WINDWALKER_TEST_DB_DSN_SQLITE" value="dbname=tmp/test.db;prefix=ww_"/>
18+
<env name="REDIS_ENABLED" value="1"/>
19+
<env name="MEMCACHED_ENABLED" value="1"/>
20+
<env name="SWOOLE_ENABLED" value="1"/>
21+
</php>
22+
<testsuites>
23+
<testsuite name="Unit">
24+
<directory>packages/*/test</directory>
25+
</testsuite>
26+
</testsuites>
27+
<!-- <logging>-->
28+
<!-- <log type="coverage-text" target="php://stdout" showUncoveredFiles="false"/>-->
29+
<!-- </logging>-->
30+
<source>
31+
<include>
32+
<directory suffix=".php">packages</directory>
33+
</include>
34+
<exclude>
35+
<directory suffix=".php">packages/*/test</directory>
36+
<directory suffix=".php">packages/*/.ide</directory>
37+
<directory suffix=".php">packages/*/resources</directory>
38+
</exclude>
39+
</source>
4140
</phpunit>

phpunit.xml.dist

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit
3-
bootstrap="vendor/autoload.php"
4-
convertErrorsToExceptions="true"
5-
convertNoticesToExceptions="true"
6-
convertWarningsToExceptions="true"
7-
syntaxCheck="true"
8-
>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
bootstrap="vendor/autoload.php"
4+
colors="false"
5+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd"
6+
cacheDirectory=".phpunit.cache"
7+
>
98
<php>
109
<ini name="error_reporting" value="-1" />
1110

0 commit comments

Comments
 (0)