Skip to content

Commit 6942f3a

Browse files
authored
test: skip the ReplaceModelTest cases that SQLSRV's replace() cannot run (#10697)
1 parent 05c3daa commit 6942f3a

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

‎tests/system/Models/ReplaceModelTest.php‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ public function testReplaceProtectsFieldsWhenReturningSQL(): void
9393

9494
$this->assertIsString($sql);
9595
$this->assertStringNotContainsString('description', $sql);
96-
$this->seeInDatabase('job', ['id' => 1, 'name' => 'Developer']);
96+
97+
if ($this->db->DBDriver !== 'SQLSRV') {
98+
$this->seeInDatabase('job', ['id' => 1, 'name' => 'Developer']);
99+
}
97100
}
98101

99102
public function testReplaceWithProtectionDisabled(): void
@@ -125,6 +128,10 @@ public function testReplaceWithoutAllowedFields(): void
125128

126129
public function testReplacePreservesCustomPrimaryKey(): void
127130
{
131+
if ($this->db->DBDriver === 'SQLSRV') {
132+
$this->markTestSkipped('SQLSRV replace() requires an identity column.');
133+
}
134+
128135
$model = $this->createModel(WithoutAutoIncrementModel::class);
129136

130137
$this->assertNotFalse($model->replace([
@@ -246,6 +253,10 @@ public static function provideReplaceWithEmptyDataUsesBuilderData(): iterable
246253

247254
public function testReplaceWithEmptyDataCanGenerateTimestamps(): void
248255
{
256+
if ($this->db->DBDriver === 'SQLSRV') {
257+
$this->markTestSkipped('SQLSRV replace() deletes by key fields and rejects data without them.');
258+
}
259+
249260
$model = $this->createModel(JobModel::class);
250261
$this->setPrivateProperty($model, 'useTimestamps', true);
251262

0 commit comments

Comments
 (0)