From 22dba8c297ec04d3efec4b1f1afec15c5a087959 Mon Sep 17 00:00:00 2001 From: Stefan Heimes Date: Mon, 26 Jan 2026 14:57:44 +0100 Subject: [PATCH 1/3] Correct the deep copy and testing system --- .github/workflows/diagnostics.yml | 2 +- .phpcq.yaml.dist | 11 +++++++++++ src/EventListener/BackendEventListener.php | 11 +++++++++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/workflows/diagnostics.yml b/.github/workflows/diagnostics.yml index 9cc2cf8..ddb119f 100644 --- a/.github/workflows/diagnostics.yml +++ b/.github/workflows/diagnostics.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - php: [ '8.1', '8.2', '8.3' ] + php: [ '8.2', '8.3' ] contao: [ '~4.13.0' ] phpcq_install: [ 'update' ] output: [ '-o github-action -o default' ] diff --git a/.phpcq.yaml.dist b/.phpcq.yaml.dist index 538ce32..3345178 100644 --- a/.phpcq.yaml.dist +++ b/.phpcq.yaml.dist @@ -12,6 +12,9 @@ phpcq: phpunit: version: ^1.0 signed: false + requirements: + phpunit: + version: ^11.5.48 psalm: version: ^1.0 signed: false @@ -39,22 +42,30 @@ phpcq: trusted-keys: # composer-require-checker - 033E5F8D801A2F8D + - B2BDAAAC6F1FDE528CD9EEC9033E5F8D801A2F8D # sb@sebastian-bergmann.de - 4AA394086372C20A + - D8406D0D82947747293778314AA394086372C20A # psalm - 8A03EA3B385DBAA1 - 12CE0F1D262429A5 + - 2DE50EB60C013FFFA831040D12CE0F1D262429A5 # magl@magll.net - D2CCAC42F6295E7D # PHP_CodeSniffer - 31C7E470E2138192 - 5E6DDE998AB73B8E - A978220305CD5C32 + - 689DAD778FF08760E046228BA978220305CD5C32 + - 97B02DD8E5071466 + - D91D86963AF3A29B6520462297B02DD8E5071466 # Composer normalize - C00543248C87FB13 + - 0FDE18AE1D09E19F60F6B1CBC00543248C87FB13 # phpmd - A4E55EA12C7C085C - 9093F8B32E4815AA + - E7A745102ECC980F7338B3079093F8B32E4815AA tasks: fix: diff --git a/src/EventListener/BackendEventListener.php b/src/EventListener/BackendEventListener.php index 2bba74f..6fea4ba 100644 --- a/src/EventListener/BackendEventListener.php +++ b/src/EventListener/BackendEventListener.php @@ -145,11 +145,18 @@ private function duplicateContentEntries(string $strTable, int $intSourceId, int $arrContent['pid'] = $intDestinationId; unset($arrContent['id']); + $parameters = []; + foreach (array_keys($arrContent) as $key) { + $parameters[$key] = '?'; + } + $this->connection ->createQueryBuilder() ->insert('tl_content') - ->setParameters($arrContent) - ->executeQuery(); + ->values($parameters) + ->setParameters(array_values($arrContent)) + ->executeStatement() + ; } } } From df34cf45cfb449d76f71d3ac64624b739d3fd690 Mon Sep 17 00:00:00 2001 From: Stefan Heimes Date: Mon, 26 Jan 2026 15:01:54 +0100 Subject: [PATCH 2/3] Correct a phpunit test --- tests/Widgets/ContentArticleWidgetTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/Widgets/ContentArticleWidgetTest.php b/tests/Widgets/ContentArticleWidgetTest.php index 59f0066..67e9662 100644 --- a/tests/Widgets/ContentArticleWidgetTest.php +++ b/tests/Widgets/ContentArticleWidgetTest.php @@ -65,7 +65,10 @@ public function testNewInstance(): void $widget ->expects(self::any()) ->method('import') - ->withConsecutive([Config::class, 'Config']); + ->willReturnCallback(function ($parameters) { + $this->assertInstanceof(Config::class, $parameters[0]); + $this->assertSame('Config', $parameters[1]); + }); self::assertEmpty($widget->getAttributes()); } From 03910c6932a2dd3b83d03ddd98002bbd0615b4fd Mon Sep 17 00:00:00 2001 From: Stefan Heimes Date: Tue, 27 Jan 2026 16:56:16 +0100 Subject: [PATCH 3/3] Correct a test file. --- tests/Widgets/ContentArticleWidgetTest.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/Widgets/ContentArticleWidgetTest.php b/tests/Widgets/ContentArticleWidgetTest.php index 67e9662..71a8216 100644 --- a/tests/Widgets/ContentArticleWidgetTest.php +++ b/tests/Widgets/ContentArticleWidgetTest.php @@ -63,12 +63,9 @@ public function testNewInstance(): void ->getMock(); $widget - ->expects(self::any()) + ->expects($this->never()) ->method('import') - ->willReturnCallback(function ($parameters) { - $this->assertInstanceof(Config::class, $parameters[0]); - $this->assertSame('Config', $parameters[1]); - }); + ->with(Config::class, 'Config'); self::assertEmpty($widget->getAttributes()); }