Skip to content

Commit 924d8d5

Browse files
Merge pull request #819 from ChristophWurst/copilot/run-rector-and-commit-changes
chore: apply Rector refactors to ConfigTest
2 parents 78641a2 + 3a9ae16 commit 924d8d5

1 file changed

Lines changed: 21 additions & 21 deletions

File tree

tests/Unit/ConfigTest.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
use OCP\IConfig;
2929
use PHPUnit\Framework\MockObject\MockObject;
3030

31-
class ConfigTest extends TestCase {
31+
final class ConfigTest extends TestCase {
3232

3333
private IConfig|MockObject $nextcloudConfig;
3434
private Config $config;
@@ -48,7 +48,7 @@ public function testGetPublicDsnReturnsNullWhenEmpty(): void {
4848

4949
$result = $this->config->getPublicDsn();
5050

51-
self::assertNull($result);
51+
$this->assertNull($result);
5252
}
5353

5454
public function testGetPublicDsnReturnsValue(): void {
@@ -59,7 +59,7 @@ public function testGetPublicDsnReturnsValue(): void {
5959

6060
$result = $this->config->getPublicDsn();
6161

62-
self::assertSame('https://key@sentry.example.com/1', $result);
62+
$this->assertSame('https://key@sentry.example.com/1', $result);
6363
}
6464

6565
public function testGetDsnPrefersDeprecatedKey(): void {
@@ -72,7 +72,7 @@ public function testGetDsnPrefersDeprecatedKey(): void {
7272

7373
$result = $this->config->getDsn();
7474

75-
self::assertSame('https://secret@sentry.example.com/1', $result);
75+
$this->assertSame('https://secret@sentry.example.com/1', $result);
7676
}
7777

7878
public function testGetDsnFallsBackToPublicDsn(): void {
@@ -85,7 +85,7 @@ public function testGetDsnFallsBackToPublicDsn(): void {
8585

8686
$result = $this->config->getDsn();
8787

88-
self::assertSame('https://public@sentry.example.com/1', $result);
88+
$this->assertSame('https://public@sentry.example.com/1', $result);
8989
}
9090

9191
public function testGetDsnReturnsNullWhenBothEmpty(): void {
@@ -95,7 +95,7 @@ public function testGetDsnReturnsNullWhenBothEmpty(): void {
9595

9696
$result = $this->config->getDsn();
9797

98-
self::assertNull($result);
98+
$this->assertNull($result);
9999
}
100100

101101
public function testGetCspReportUrlReturnsNullWhenEmpty(): void {
@@ -106,7 +106,7 @@ public function testGetCspReportUrlReturnsNullWhenEmpty(): void {
106106

107107
$result = $this->config->getCspReportUrl();
108108

109-
self::assertNull($result);
109+
$this->assertNull($result);
110110
}
111111

112112
public function testGetCspReportUrlReturnsValue(): void {
@@ -117,7 +117,7 @@ public function testGetCspReportUrlReturnsValue(): void {
117117

118118
$result = $this->config->getCspReportUrl();
119119

120-
self::assertSame('https://sentry.example.com/api/1/security/', $result);
120+
$this->assertSame('https://sentry.example.com/api/1/security/', $result);
121121
}
122122

123123
public function testGetServerVersionReturnsDefault(): void {
@@ -128,7 +128,7 @@ public function testGetServerVersionReturnsDefault(): void {
128128

129129
$result = $this->config->getServerVersion();
130130

131-
self::assertSame('0.0.0', $result);
131+
$this->assertSame('0.0.0', $result);
132132
}
133133

134134
public function testGetServerVersionReturnsConfigured(): void {
@@ -139,7 +139,7 @@ public function testGetServerVersionReturnsConfigured(): void {
139139

140140
$result = $this->config->getServerVersion();
141141

142-
self::assertSame('28.0.1', $result);
142+
$this->assertSame('28.0.1', $result);
143143
}
144144

145145
public function testGetSamplingRateFromConfig(): void {
@@ -150,7 +150,7 @@ public function testGetSamplingRateFromConfig(): void {
150150

151151
$result = $this->config->getSamplingRate();
152152

153-
self::assertSame(0.5, $result);
153+
$this->assertEqualsWithDelta(0.5, $result, PHP_FLOAT_EPSILON);
154154
}
155155

156156
public function testGetSamplingRateFromLogLevel(): void {
@@ -165,7 +165,7 @@ public function testGetSamplingRateFromLogLevel(): void {
165165

166166
$result = $this->config->getSamplingRate();
167167

168-
self::assertSame(1.0, $result);
168+
$this->assertEqualsWithDelta(1.0, $result, PHP_FLOAT_EPSILON);
169169
}
170170

171171
public function testGetSamplingRateDefaultLogLevel(): void {
@@ -180,7 +180,7 @@ public function testGetSamplingRateDefaultLogLevel(): void {
180180

181181
$result = $this->config->getSamplingRate();
182182

183-
self::assertSame(0.3, $result);
183+
$this->assertEqualsWithDelta(0.3, $result, PHP_FLOAT_EPSILON);
184184
}
185185

186186
public function testGetProfilesSamplingRateFromConfig(): void {
@@ -191,7 +191,7 @@ public function testGetProfilesSamplingRateFromConfig(): void {
191191

192192
$result = $this->config->getProfilesSamplingRate();
193193

194-
self::assertSame(0.8, $result);
194+
$this->assertEqualsWithDelta(0.8, $result, PHP_FLOAT_EPSILON);
195195
}
196196

197197
public function testGetProfilesSamplingRateFromLogLevel(): void {
@@ -206,7 +206,7 @@ public function testGetProfilesSamplingRateFromLogLevel(): void {
206206

207207
$result = $this->config->getProfilesSamplingRate();
208208

209-
self::assertSame(0.7, $result);
209+
$this->assertEqualsWithDelta(0.7, $result, PHP_FLOAT_EPSILON);
210210
}
211211

212212
public function testGetProfilesSamplingRateReturnsFloat(): void {
@@ -217,8 +217,8 @@ public function testGetProfilesSamplingRateReturnsFloat(): void {
217217

218218
$result = $this->config->getProfilesSamplingRate();
219219

220-
self::assertIsFloat($result);
221-
self::assertSame(0.42, $result);
220+
$this->assertIsFloat($result);
221+
$this->assertEqualsWithDelta(0.42, $result, PHP_FLOAT_EPSILON);
222222
}
223223

224224
public function testGetEnvironmentReturnsDefault(): void {
@@ -229,7 +229,7 @@ public function testGetEnvironmentReturnsDefault(): void {
229229

230230
$result = $this->config->getEnvironment();
231231

232-
self::assertSame('production', $result);
232+
$this->assertSame('production', $result);
233233
}
234234

235235
public function testGetEnvironmentReturnsConfigured(): void {
@@ -240,7 +240,7 @@ public function testGetEnvironmentReturnsConfigured(): void {
240240

241241
$result = $this->config->getEnvironment();
242242

243-
self::assertSame('staging', $result);
243+
$this->assertSame('staging', $result);
244244
}
245245

246246
public function testGetMaxRequestBodySizeReturnsDefault(): void {
@@ -251,7 +251,7 @@ public function testGetMaxRequestBodySizeReturnsDefault(): void {
251251

252252
$result = $this->config->getMaxRequestBodySize();
253253

254-
self::assertSame('never', $result);
254+
$this->assertSame('never', $result);
255255
}
256256

257257
public function testGetMaxRequestBodySizeReturnsConfigured(): void {
@@ -262,6 +262,6 @@ public function testGetMaxRequestBodySizeReturnsConfigured(): void {
262262

263263
$result = $this->config->getMaxRequestBodySize();
264264

265-
self::assertSame('medium', $result);
265+
$this->assertSame('medium', $result);
266266
}
267267
}

0 commit comments

Comments
 (0)