|
17 | 17 | use Doctrine\DBAL\Result; |
18 | 18 | use Doctrine\DBAL\Schema\AbstractSchemaManager; |
19 | 19 | use Doctrine\DBAL\Schema\Column; |
| 20 | +use Doctrine\DBAL\Schema\Comparator; |
20 | 21 | use Doctrine\DBAL\Schema\Schema; |
| 22 | +use Doctrine\DBAL\Schema\SchemaDiff; |
21 | 23 | use Doctrine\DBAL\Schema\Table; |
22 | 24 | use PHPUnit\Framework\TestCase; |
23 | 25 | use Symfony\AI\Chat\Bridge\Doctrine\DoctrineDbalMessageStore; |
@@ -76,15 +78,23 @@ public function testMessageStoreTableCanBeSetup() |
76 | 78 | $schema = $this->createMock(Schema::class); |
77 | 79 | $schema->expects($this->once())->method('hasTable')->willReturn(false); |
78 | 80 | $schema->expects($this->once())->method('createTable')->with('foo')->willReturn($table); |
79 | | - $schema->expects($this->once())->method('toSql')->with($platform)->willReturn([]); |
80 | 81 |
|
81 | 82 | $sqliteSchemaManager = $this->createMock(AbstractSchemaManager::class); |
82 | 83 | $sqliteSchemaManager->expects($this->once())->method('introspectSchema')->willReturn($schema); |
83 | 84 |
|
| 85 | + $comparator = $this->createMock(Comparator::class); |
| 86 | + $sqliteSchemaManager->expects($this->once())->method('createComparator')->willReturn($comparator); |
| 87 | + |
84 | 88 | $connection = $this->createMock(Connection::class); |
85 | 89 | $connection->expects($this->once())->method('createSchemaManager')->willReturn($sqliteSchemaManager); |
86 | 90 | $connection->expects($this->exactly(2))->method('getDatabasePlatform')->willReturn($platform); |
87 | 91 |
|
| 92 | + $schemaDiff = $this->createMock(SchemaDiff::class); |
| 93 | + |
| 94 | + $comparator->expects($this->once())->method('compareSchemas')->willReturn($schemaDiff); |
| 95 | + $platform->expects($this->once())->method('getAlterSchemaSQL')->willReturn(['SQL STATEMENT']); |
| 96 | + $connection->expects($this->once())->method('executeQuery')->with('SQL STATEMENT'); |
| 97 | + |
88 | 98 | $messageStore = new DoctrineDbalMessageStore('foo', $connection); |
89 | 99 | $messageStore->setup(); |
90 | 100 | } |
|
0 commit comments