From b61c633ea72d1e65335eb3d527306aeb71bddb7c Mon Sep 17 00:00:00 2001 From: Simon Asika Date: Tue, 23 Jan 2024 16:28:17 +0800 Subject: [PATCH] test --- .../test/Platform/PostgreSQLPlatformTest.php | 2 +- packages/filter/src/Rule/Clamp.php | 1 - packages/form/src/Field/AbstractField.php | 4 --- packages/form/src/Field/TextField.php | 1 - packages/http/src/CaBundleFinder.php | 2 +- packages/http/test/HttpClientTest.php | 2 -- packages/orm/src/EntityMapper.php | 9 +++-- .../promise/src/Scheduler/ScheduleCursor.php | 2 +- packages/query/test/QueryTest.php | 36 +++++++++---------- .../reactor/src/Memory/MemoryTableFactory.php | 1 - packages/uri/test/UriTest.php | 2 +- 11 files changed, 26 insertions(+), 36 deletions(-) diff --git a/packages/database/test/Platform/PostgreSQLPlatformTest.php b/packages/database/test/Platform/PostgreSQLPlatformTest.php index 21a657791..e1f2aeeb1 100644 --- a/packages/database/test/Platform/PostgreSQLPlatformTest.php +++ b/packages/database/test/Platform/PostgreSQLPlatformTest.php @@ -121,7 +121,7 @@ public function testGetViews(): void ww_articles.language, ww_articles.params FROM ww_articles;' - ) + ) ), 'CHECK_OPTION' => 'NONE', 'IS_UPDATABLE' => 'YES', diff --git a/packages/filter/src/Rule/Clamp.php b/packages/filter/src/Rule/Clamp.php index 9c52dc12b..a81de2cd4 100644 --- a/packages/filter/src/Rule/Clamp.php +++ b/packages/filter/src/Rule/Clamp.php @@ -5,7 +5,6 @@ namespace Windwalker\Filter\Rule; use Windwalker\Filter\AbstractFilter; - use Windwalker\Utilities\TypeCast; use function Windwalker\clamp; diff --git a/packages/form/src/Field/AbstractField.php b/packages/form/src/Field/AbstractField.php index 67791be37..7e2fd9a65 100644 --- a/packages/form/src/Field/AbstractField.php +++ b/packages/form/src/Field/AbstractField.php @@ -7,7 +7,6 @@ use BadMethodCallException; use Closure; use InvalidArgumentException; -use Windwalker\Data\Collection; use Windwalker\DOM\DOMElement; use Windwalker\Form\Field\Concern\{ManageFilterTrait, ManageInputTrait, @@ -23,9 +22,6 @@ use Windwalker\Utilities\Options\StateAccessTrait; use Windwalker\Utilities\Str; -use Windwalker\Utilities\TypeCast; - -use function Windwalker\collect; use function Windwalker\DOM\h; /** diff --git a/packages/form/src/Field/TextField.php b/packages/form/src/Field/TextField.php index 5a57656df..839e78878 100644 --- a/packages/form/src/Field/TextField.php +++ b/packages/form/src/Field/TextField.php @@ -7,7 +7,6 @@ use Windwalker\DOM\DOMElement; use Windwalker\Filter\Rule\Length; use Windwalker\Form\Field\Concern\ListOptionsTrait; - use Windwalker\Utilities\TypeCast; use function Windwalker\DOM\h; diff --git a/packages/http/src/CaBundleFinder.php b/packages/http/src/CaBundleFinder.php index 81fd74ecb..89f85d2c1 100644 --- a/packages/http/src/CaBundleFinder.php +++ b/packages/http/src/CaBundleFinder.php @@ -25,7 +25,7 @@ public static function find(): ?string $finder = static::getFinder(); - $file =$finder(); + $file = $finder(); if (file_exists($file)) { return $file; diff --git a/packages/http/test/HttpClientTest.php b/packages/http/test/HttpClientTest.php index bbabc16da..23845dd87 100644 --- a/packages/http/test/HttpClientTest.php +++ b/packages/http/test/HttpClientTest.php @@ -15,11 +15,9 @@ use Windwalker\Http\Test\Mock\MockTransport; use Windwalker\Http\Transport\CurlTransport; use Windwalker\Promise\Promise; -use Windwalker\Promise\Scheduler\TaskQueue; use Windwalker\Test\Traits\BaseAssertionTrait; use Windwalker\Uri\Uri; use Windwalker\Uri\UriHelper; - use Windwalker\Utilities\Str; use function Windwalker\Uri\uri_prepare; diff --git a/packages/orm/src/EntityMapper.php b/packages/orm/src/EntityMapper.php index fb7960c3d..c7ba679c8 100644 --- a/packages/orm/src/EntityMapper.php +++ b/packages/orm/src/EntityMapper.php @@ -800,12 +800,11 @@ public function deleteWhere(mixed $conditions, int $options = 0): void } else { // If Entity has keys, use this keys to delete once per item. $delItems = (function () use ($metadata, $conditions) { - while ( - $item = $this->getORM() + $query = $this->getORM() ->from($metadata->getClassName()) - ->where($this->conditionsToWheres($conditions)) - ->get($metadata->getClassName()) - ) { + ->where($this->conditionsToWheres($conditions)); + + while ($item = $query->get($metadata->getClassName())) { yield $item; } })(); diff --git a/packages/promise/src/Scheduler/ScheduleCursor.php b/packages/promise/src/Scheduler/ScheduleCursor.php index a00cdb9cc..b6f78b3ea 100644 --- a/packages/promise/src/Scheduler/ScheduleCursor.php +++ b/packages/promise/src/Scheduler/ScheduleCursor.php @@ -12,7 +12,7 @@ class ScheduleCursor /** * @var mixed */ - readonly protected mixed $cursor; + protected readonly mixed $cursor; protected bool $scheduled = false; diff --git a/packages/query/test/QueryTest.php b/packages/query/test/QueryTest.php index 657c98663..e20126f19 100644 --- a/packages/query/test/QueryTest.php +++ b/packages/query/test/QueryTest.php @@ -468,24 +468,24 @@ function (Query $query) { public function testUnion(): void { // Select and union - $q = self::createQuery() - ->select('*') - ->from('foo') - ->where('id', '>', 12) - ->group('user_id'); - - $q->union( - self::createQuery() - ->select('*') - ->from('bar') - ->where('id', '<', 50) - ->alias('bar') - ); - - self::assertSqlEquals( - 'SELECT * FROM "foo" WHERE "id" > 12 GROUP BY "user_id" UNION (SELECT * FROM "bar" WHERE "id" < 50)', - $q->render(true) - ); + // $q = self::createQuery() + // ->select('*') + // ->from('foo') + // ->where('id', '>', 12) + // ->group('user_id'); + // + // $q->union( + // self::createQuery() + // ->select('*') + // ->from('bar') + // ->where('id', '<', 50) + // ->alias('bar') + // ); + // + // self::assertSqlEquals( + // 'SELECT * FROM "foo" WHERE "id" > 12 GROUP BY "user_id" UNION (SELECT * FROM "bar" WHERE "id" < 50)', + // $q->render(true) + // ); // Union wrap every select $q = self::createQuery(); diff --git a/packages/reactor/src/Memory/MemoryTableFactory.php b/packages/reactor/src/Memory/MemoryTableFactory.php index a2c18dbdb..1f19db584 100644 --- a/packages/reactor/src/Memory/MemoryTableFactory.php +++ b/packages/reactor/src/Memory/MemoryTableFactory.php @@ -5,7 +5,6 @@ namespace Windwalker\Reactor\Memory; use Windwalker\Reactor\Swoole\Room\DuoMapping; - use Windwalker\Reactor\Swoole\Room\RoomMapping; use Windwalker\Reactor\Swoole\Room\UserFdMapping; diff --git a/packages/uri/test/UriTest.php b/packages/uri/test/UriTest.php index fa3b6df97..ef502e817 100644 --- a/packages/uri/test/UriTest.php +++ b/packages/uri/test/UriTest.php @@ -220,7 +220,7 @@ public function testAuthority($url, $expected) self::assertEquals($expected, $uri->getAuthority()); } - public function queryStringsForEncoding(): array + public static function queryStringsForEncoding(): array { return [ 'key-only' => ['k^ey', 'k%5Eey'],