From 32e50cacb131aa79ac32078bfaf850f65e2fc423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Thu, 17 Aug 2023 17:27:17 +0200 Subject: [PATCH 1/5] fix ci --- tests-behat/card.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests-behat/card.feature b/tests-behat/card.feature index 839d1b1320..88552ff173 100644 --- a/tests-behat/card.feature +++ b/tests-behat/card.feature @@ -18,7 +18,7 @@ Feature: Card When I press button "Delete" Then Modal is open with text "Please go ahead. Demo mode does not really delete data." When I press Modal button "Ok" - Then Modal is open with text "Atk4\Data\Exception: Calling user action on a Model with dirty fields that are not allowed by this action" + Then Modal is open with text "Atk4\Data\Exception: User action cannot be executed when unrelated fields are dirty" Scenario: Given I am on "interactive/card-action.php" From 4811afcebe72b0f8e59d7b20f6a16d028d15634f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Thu, 17 Aug 2023 17:30:07 +0200 Subject: [PATCH 2/5] fix deprecated usage --- src/Behat/RwDemosContextTrait.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Behat/RwDemosContextTrait.php b/src/Behat/RwDemosContextTrait.php index e9a782092d..a081196a0d 100644 --- a/src/Behat/RwDemosContextTrait.php +++ b/src/Behat/RwDemosContextTrait.php @@ -6,6 +6,7 @@ use Atk4\Data\Model; use Atk4\Data\Persistence; +use Doctrine\DBAL\Types\Type; trait RwDemosContextTrait { @@ -57,7 +58,7 @@ protected function createDatabaseModelFromTable(string $table): Model $model->removeField('id'); foreach ($tableColumns as $tableColumn) { $model->addField($tableColumn->getName(), [ - 'type' => $tableColumn->getType()->getName(), // @phpstan-ignore-line Type::getName() is deprecated in DBAL 4.0 + 'type' => Type::getTypeRegistry()->lookupName($tableColumn->getType()), // TODO review once https://github.com/doctrine/dbal/pull/6130 is merged 'nullable' => !$tableColumn->getNotnull(), ]); } From 63da44d9234cc1873e3f461b80310595aaccdd25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Thu, 17 Aug 2023 17:30:54 +0200 Subject: [PATCH 3/5] never buffer HTTP test responses thru disk --- composer.json | 1 + tests/DemosHttpTest.php | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d568ae2c5f..df62ee2afe 100644 --- a/composer.json +++ b/composer.json @@ -84,6 +84,7 @@ "conflict": { "behat/behat": "<3.9", "behat/mink": "<1.9", + "guzzlehttp/psr7": "<2.4", "symfony/console": "<4.4.30 || >=5 <5.3.7", "symfony/css-selector": "<4.4.24 || >=5 <5.2.9", "symfony/filesystem": "<4.4.30 || >=5 <5.3.7", diff --git a/tests/DemosHttpTest.php b/tests/DemosHttpTest.php index c8d48ea0b0..6a1da4dea4 100644 --- a/tests/DemosHttpTest.php +++ b/tests/DemosHttpTest.php @@ -6,6 +6,7 @@ use Atk4\Ui\Callback; use GuzzleHttp\Client; +use GuzzleHttp\Psr7\LazyOpenStream; use Symfony\Component\Process\Process; /** @@ -103,7 +104,11 @@ private function setupWebserver(): void protected function getClient(): Client { - return new Client(['base_uri' => 'http://localhost:' . $this->port]); + // never buffer the response thru disk, remove once streaming with curl is supported + // https://github.com/guzzle/guzzle/issues/3115 + $sink = new LazyOpenStream('php://memory', 'w+'); + + return new Client(['base_uri' => 'http://localhost:' . $this->port, 'sink' => $sink]); } protected function getPathWithAppVars(string $path): string From f58e818801c5da5b4996873826f1d49f76b786fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Thu, 17 Aug 2023 18:45:20 +0200 Subject: [PATCH 4/5] fix OOM /w coverage --- tests/DemosTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/DemosTest.php b/tests/DemosTest.php index bc783de448..f3fac54d99 100644 --- a/tests/DemosTest.php +++ b/tests/DemosTest.php @@ -346,7 +346,7 @@ public function testDemoGet(string $path): void public function testHugeOutputStream(): void { - $sizeMb = 50; + $sizeMb = 40; $sizeBytes = $sizeMb * 1024 * 1024; $response = $this->getResponseFromRequest('_unit-test/stream.php?size_mb=' . $sizeMb); self::assertSame(200, $response->getStatusCode()); From 134fa9ee5f9b55c1db3a853eb9d597dd4e237059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Thu, 17 Aug 2023 19:40:03 +0200 Subject: [PATCH 5/5] better todo comment --- src/Behat/RwDemosContextTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Behat/RwDemosContextTrait.php b/src/Behat/RwDemosContextTrait.php index a081196a0d..f020a518fe 100644 --- a/src/Behat/RwDemosContextTrait.php +++ b/src/Behat/RwDemosContextTrait.php @@ -58,7 +58,7 @@ protected function createDatabaseModelFromTable(string $table): Model $model->removeField('id'); foreach ($tableColumns as $tableColumn) { $model->addField($tableColumn->getName(), [ - 'type' => Type::getTypeRegistry()->lookupName($tableColumn->getType()), // TODO review once https://github.com/doctrine/dbal/pull/6130 is merged + 'type' => Type::getTypeRegistry()->lookupName($tableColumn->getType()), // TODO simplify once https://github.com/doctrine/dbal/pull/6130 is merged 'nullable' => !$tableColumn->getNotnull(), ]); }