From 453bf5b1468bc77c06ea0313029dcdb1410633ff Mon Sep 17 00:00:00 2001 From: Auto-Claude Orchestrator Date: Tue, 24 Mar 2026 07:28:15 +0000 Subject: [PATCH] =?utf8?q?feat(task-JIRA-ERP-33-20260324070448):=20=D0=A1?= =?utf8?q?=D0=B1=D0=BE=D1=80=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20?= =?utf8?q?=D0=BF=D0=BE=20=D0=BE=D1=81=D1=82=D0=B0=D1=82=D0=BA=D0=B0=D0=BC?= =?utf8?q?=20=D0=BD=D0=B0=20=D0=B4=D0=B5=D0=BD=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/services/StockHistoryService.php | 4 ++-- .../tests/unit/services/StockHistoryServiceTest.php | 12 ++---------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/erp24/services/StockHistoryService.php b/erp24/services/StockHistoryService.php index e8fc063e..4a6430a9 100644 --- a/erp24/services/StockHistoryService.php +++ b/erp24/services/StockHistoryService.php @@ -212,9 +212,9 @@ class StockHistoryService $end = date('Y-m-d', strtotime($start . ' +1 month')); $suffix = str_replace('-', '_', $yearMonth); + // DDL не поддерживает bind params — используем интерполяцию (формат валидирован regex) $this->db->createCommand() - ->setSql("CREATE TABLE IF NOT EXISTS stock_history_{$suffix} PARTITION OF stock_history FOR VALUES FROM (:start) TO (:end)") - ->bindValues([':start' => $start, ':end' => $end]) + ->setSql("CREATE TABLE IF NOT EXISTS stock_history_{$suffix} PARTITION OF stock_history FOR VALUES FROM ('{$start}') TO ('{$end}')") ->execute(); } diff --git a/erp24/tests/unit/services/StockHistoryServiceTest.php b/erp24/tests/unit/services/StockHistoryServiceTest.php index 6ea0485c..56ca736c 100644 --- a/erp24/tests/unit/services/StockHistoryServiceTest.php +++ b/erp24/tests/unit/services/StockHistoryServiceTest.php @@ -245,19 +245,12 @@ class StockHistoryServiceTest extends Unit $db->method('createCommand')->willReturn($command); $executedSql = []; - $boundParams = []; $command->method('setSql')->willReturnCallback( function ($sql) use ($command, &$executedSql) { $executedSql[] = $sql; return $command; } ); - $command->method('bindValues')->willReturnCallback( - function ($values) use ($command, &$boundParams) { - $boundParams = array_merge($boundParams, $values); - return $command; - } - ); $command->method('execute')->willReturn(0); $service = new StockHistoryService($db); @@ -266,8 +259,8 @@ class StockHistoryServiceTest extends Unit $sql = implode(' ', $executedSql); $this->assertStringContainsString('PARTITION OF', $sql); $this->assertStringContainsString('stock_history_2026_04', $sql); - $this->assertEquals('2026-04-01', $boundParams[':start']); - $this->assertEquals('2026-05-01', $boundParams[':end']); + $this->assertStringContainsString('2026-04-01', $sql); + $this->assertStringContainsString('2026-05-01', $sql); } public function testCreatePartition_InvalidFormat_ThrowsException(): void @@ -294,7 +287,6 @@ class StockHistoryServiceTest extends Unit return $command; } ); - $command->method('bindValues')->willReturnSelf(); $command->method('execute')->willReturn(0); $service = new StockHistoryService($db); -- 2.39.5