fixup! refactor: Migrate away from \OCP\IDBConnection::insertIfNotExist

pull/56933/head
provokateurin 2025-12-10 16:47:56 +07:00
parent 4f7e3e539e
commit 8f26d7e628
No known key found for this signature in database
1 changed files with 23 additions and 0 deletions

@ -22,6 +22,7 @@ use OC\DB\SchemaWrapper;
use OC\Migration\MetadataManager; use OC\Migration\MetadataManager;
use OCP\App\AppPathNotFoundException; use OCP\App\AppPathNotFoundException;
use OCP\App\IAppManager; use OCP\App\IAppManager;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection; use OCP\IDBConnection;
use OCP\Migration\Attributes\AddColumn; use OCP\Migration\Attributes\AddColumn;
use OCP\Migration\Attributes\AddIndex; use OCP\Migration\Attributes\AddIndex;
@ -113,6 +114,17 @@ class MigrationsTest extends \Test\TestCase {
$this->db->expects($this->once()) $this->db->expects($this->once())
->method('migrateToSchema'); ->method('migrateToSchema');
$qb = $this->createMock(IQueryBuilder::class);
$qb
->expects($this->once())
->method('insert')
->willReturn($qb);
$this->db
->expects($this->once())
->method('getQueryBuilder')
->willReturn($qb);
$wrappedSchema = $this->createMock(Schema::class); $wrappedSchema = $this->createMock(Schema::class);
$wrappedSchema->expects($this->exactly(2)) $wrappedSchema->expects($this->exactly(2))
->method('getTables') ->method('getTables')
@ -156,6 +168,17 @@ class MigrationsTest extends \Test\TestCase {
$this->db->expects($this->never()) $this->db->expects($this->never())
->method('migrateToSchema'); ->method('migrateToSchema');
$qb = $this->createMock(IQueryBuilder::class);
$qb
->expects($this->once())
->method('insert')
->willReturn($qb);
$this->db
->expects($this->once())
->method('getQueryBuilder')
->willReturn($qb);
$step = $this->createMock(IMigrationStep::class); $step = $this->createMock(IMigrationStep::class);
$step->expects($this->once()) $step->expects($this->once())
->method('preSchemaChange'); ->method('preSchemaChange');