Skip to content

Commit 16fe250

Browse files
committed
test: moved DBDriver check to setUp() instead of checking in each test
1 parent 56775d0 commit 16fe250

File tree

1 file changed

+4
-32
lines changed

1 file changed

+4
-32
lines changed

tests/system/Database/Live/MySQLi/FoundRowsTest.php

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ protected function setUp(): void
4242
$config = config('Database');
4343

4444
$this->tests = $config->tests;
45+
46+
if ($this->tests['DBDriver'] !== 'MySQLi') {
47+
$this->markTestSkipped('Only MySQLi can complete this test.');
48+
}
4549
}
4650

4751
public function testEnableFoundRows(): void
@@ -50,10 +54,6 @@ public function testEnableFoundRows(): void
5054

5155
$db1 = Database::connect($this->tests);
5256

53-
if ($db1->DBDriver !== 'MySQLi') {
54-
$this->markTestSkipped('Only MySQLi can complete this test.');
55-
}
56-
5757
$this->assertTrue($db1->foundRows);
5858
}
5959

@@ -63,10 +63,6 @@ public function testDisableFoundRows(): void
6363

6464
$db1 = Database::connect($this->tests);
6565

66-
if ($db1->DBDriver !== 'MySQLi') {
67-
$this->markTestSkipped('Only MySQLi can complete this test.');
68-
}
69-
7066
$this->assertFalse($db1->foundRows);
7167
}
7268

@@ -76,10 +72,6 @@ public function testAffectedRowsAfterEnableFoundRowsWithNoChange(): void
7672

7773
$db1 = Database::connect($this->tests);
7874

79-
if ($db1->DBDriver !== 'MySQLi') {
80-
$this->markTestSkipped('Only MySQLi can complete this test.');
81-
}
82-
8375
$db1->table('db_user')
8476
->set('country', 'US')
8577
->where('country', 'US')
@@ -96,10 +88,6 @@ public function testAffectedRowsAfterDisableFoundRowsWithNoChange(): void
9688

9789
$db1 = Database::connect($this->tests);
9890

99-
if ($db1->DBDriver !== 'MySQLi') {
100-
$this->markTestSkipped('Only MySQLi can complete this test.');
101-
}
102-
10391
$db1->table('db_user')
10492
->set('country', 'US')
10593
->where('country', 'US')
@@ -116,10 +104,6 @@ public function testAffectedRowsAfterEnableFoundRowsWithChange(): void
116104

117105
$db1 = Database::connect($this->tests);
118106

119-
if ($db1->DBDriver !== 'MySQLi') {
120-
$this->markTestSkipped('Only MySQLi can complete this test.');
121-
}
122-
123107
$db1->table('db_user')
124108
->set('country', 'NZ')
125109
->where('country', 'US')
@@ -136,10 +120,6 @@ public function testAffectedRowsAfterDisableFoundRowsWithChange(): void
136120

137121
$db1 = Database::connect($this->tests);
138122

139-
if ($db1->DBDriver !== 'MySQLi') {
140-
$this->markTestSkipped('Only MySQLi can complete this test.');
141-
}
142-
143123
$db1->table('db_user')
144124
->set('country', 'NZ')
145125
->where('country', 'US')
@@ -156,10 +136,6 @@ public function testAffectedRowsAfterEnableFoundRowsWithPartialChange(): void
156136

157137
$db1 = Database::connect($this->tests);
158138

159-
if ($db1->DBDriver !== 'MySQLi') {
160-
$this->markTestSkipped('Only MySQLi can complete this test.');
161-
}
162-
163139
$db1->table('db_user')
164140
->set('name', 'Derek Jones')
165141
->where('country', 'US')
@@ -176,10 +152,6 @@ public function testAffectedRowsAfterDisableFoundRowsWithPartialChange(): void
176152

177153
$db1 = Database::connect($this->tests);
178154

179-
if ($db1->DBDriver !== 'MySQLi') {
180-
$this->markTestSkipped('Only MySQLi can complete this test.');
181-
}
182-
183155
$db1->table('db_user')
184156
->set('name', 'Derek Jones')
185157
->where('country', 'US')

0 commit comments

Comments
 (0)