]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
feat(task-JIRA-ERP-33-20260324070448): Сбор данных по остаткам на день
authorAuto-Claude Orchestrator <orchestrator@auto-claude.local>
Tue, 24 Mar 2026 07:22:01 +0000 (07:22 +0000)
committerAuto-Claude Orchestrator <orchestrator@auto-claude.local>
Tue, 24 Mar 2026 07:22:01 +0000 (07:22 +0000)
erp24/tests/unit/services/StockHistoryServiceTest.php

index 2ffdfaf3d9e56ab15c9887a5926f0b8dffa2e8ed..6ea0485c78eab8b6377d5e8febafa3b101d612bd 100644 (file)
@@ -120,7 +120,12 @@ class StockHistoryServiceTest extends Unit
 
     public function testCollect_OnConflictUpdate_UsesUpsertQuery(): void
     {
-        [$db, $command] = $this->createMockDbAndCommand();
+        $db = $this->createMock(\yii\db\Connection::class);
+        $command = $this->createMock(\yii\db\Command::class);
+
+        $db->method('createCommand')->willReturn($command);
+        $command->method('bindValues')->willReturnSelf();
+        $command->method('bindValue')->willReturnSelf();
 
         $command->method('queryScalar')
             ->willReturnOnConsecutiveCalls(true, 1, 1, 1, 0, 0, 0, 1, true);
@@ -234,7 +239,10 @@ class StockHistoryServiceTest extends Unit
 
     public function testCreatePartition_CreatesPartitionTable(): void
     {
-        [$db, $command] = $this->createMockDbAndCommand();
+        $db = $this->createMock(\yii\db\Connection::class);
+        $command = $this->createMock(\yii\db\Command::class);
+
+        $db->method('createCommand')->willReturn($command);
 
         $executedSql = [];
         $boundParams = [];
@@ -274,7 +282,10 @@ class StockHistoryServiceTest extends Unit
 
     public function testEnsurePartitions_CreatesCurrentAndNextMonth(): void
     {
-        [$db, $command] = $this->createMockDbAndCommand();
+        $db = $this->createMock(\yii\db\Connection::class);
+        $command = $this->createMock(\yii\db\Command::class);
+
+        $db->method('createCommand')->willReturn($command);
 
         $executedSql = [];
         $command->method('setSql')->willReturnCallback(
@@ -295,7 +306,12 @@ class StockHistoryServiceTest extends Unit
 
     public function testDropOldPartitions_DropsPartitionsOlderThanRetention(): void
     {
-        [$db, $command] = $this->createMockDbAndCommand();
+        $db = $this->createMock(\yii\db\Connection::class);
+        $command = $this->createMock(\yii\db\Command::class);
+
+        $db->method('createCommand')->willReturn($command);
+        $command->method('bindValues')->willReturnSelf();
+        $command->method('bindValue')->willReturnSelf();
 
         $command->method('queryAll')->willReturn([
             ['tablename' => 'stock_history_2023_11'],