Skip to content

Commit c47064b

Browse files
committed
fix(tests): replace addToAssertionCount checkbox tests with DoesNotPerformAssertions in Hooks and DI tests
Signed-off-by: Anna Larch <anna@nextcloud.com> AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 492a42b commit c47064b

2 files changed

Lines changed: 7 additions & 27 deletions

File tree

tests/lib/AppFramework/Bootstrap/FunctionInjectorTest.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,10 @@ public function testInjectFnNotRegistered(): void {
3434
});
3535
}
3636

37+
#[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions]
3738
public function testInjectFnNotRegisteredButNullable(): void {
3839
(new FunctionInjector($this->container))->injectFn(static function (?Foo $p1): void {
3940
});
40-
41-
// Nothing to assert. No errors means everything is fine.
42-
$this->addToAssertionCount(1);
4341
}
4442

4543
public function testInjectFnByType(): void {
@@ -51,18 +49,13 @@ public function testInjectFnByType(): void {
5149

5250
(new FunctionInjector($this->container))->injectFn(static function (Foo $p1): void {
5351
});
54-
55-
// Nothing to assert. No errors means everything is fine.
56-
$this->addToAssertionCount(1);
5752
}
5853

54+
#[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions]
5955
public function testInjectFnByName(): void {
6056
$this->container->registerParameter('test', 'abc');
6157

6258
(new FunctionInjector($this->container))->injectFn(static function ($test): void {
6359
});
64-
65-
// Nothing to assert. No errors means everything is fine.
66-
$this->addToAssertionCount(1);
6760
}
6861
}

tests/lib/Hooks/BasicEmitterTest.php

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -153,17 +153,17 @@ public function testNamedArguments(): void {
153153
$this->emitter->emitEvent('Test', 'test', ['foo' => 'foo', 'bar' => 'bar']);
154154
}
155155

156+
#[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions]
156157
public function testRemoveAllSpecified(): void {
157158
$listener = function (): void {
158159
throw new EmittedException;
159160
};
160161
$this->emitter->listen('Test', 'test', $listener);
161162
$this->emitter->removeListener('Test', 'test', $listener);
162163
$this->emitter->emitEvent('Test', 'test');
163-
164-
$this->addToAssertionCount(1);
165164
}
166165

166+
#[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions]
167167
public function testRemoveWildcardListener(): void {
168168
$listener1 = function (): void {
169169
throw new EmittedException;
@@ -175,10 +175,9 @@ public function testRemoveWildcardListener(): void {
175175
$this->emitter->listen('Test', 'test', $listener2);
176176
$this->emitter->removeListener('Test', 'test');
177177
$this->emitter->emitEvent('Test', 'test');
178-
179-
$this->addToAssertionCount(1);
180178
}
181179

180+
#[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions]
182181
public function testRemoveWildcardMethod(): void {
183182
$listener = function (): void {
184183
throw new EmittedException;
@@ -188,10 +187,9 @@ public function testRemoveWildcardMethod(): void {
188187
$this->emitter->removeListener('Test', null, $listener);
189188
$this->emitter->emitEvent('Test', 'test');
190189
$this->emitter->emitEvent('Test', 'foo');
191-
192-
$this->addToAssertionCount(1);
193190
}
194191

192+
#[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions]
195193
public function testRemoveWildcardScope(): void {
196194
$listener = function (): void {
197195
throw new EmittedException;
@@ -201,10 +199,9 @@ public function testRemoveWildcardScope(): void {
201199
$this->emitter->removeListener(null, 'test', $listener);
202200
$this->emitter->emitEvent('Test', 'test');
203201
$this->emitter->emitEvent('Bar', 'test');
204-
205-
$this->addToAssertionCount(1);
206202
}
207203

204+
#[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions]
208205
public function testRemoveWildcardScopeAndMethod(): void {
209206
$listener = function (): void {
210207
throw new EmittedException;
@@ -216,8 +213,6 @@ public function testRemoveWildcardScopeAndMethod(): void {
216213
$this->emitter->emitEvent('Test', 'test');
217214
$this->emitter->emitEvent('Test', 'foo');
218215
$this->emitter->emitEvent('Bar', 'foo');
219-
220-
$this->addToAssertionCount(1);
221216
}
222217

223218

@@ -234,8 +229,6 @@ public function testRemoveKeepOtherCallback(): void {
234229
$this->emitter->listen('Test', 'test', $listener2);
235230
$this->emitter->removeListener('Test', 'test', $listener1);
236231
$this->emitter->emitEvent('Test', 'test');
237-
238-
$this->addToAssertionCount(1);
239232
}
240233

241234

@@ -249,8 +242,6 @@ public function testRemoveKeepOtherMethod(): void {
249242
$this->emitter->listen('Test', 'foo', $listener);
250243
$this->emitter->removeListener('Test', 'foo', $listener);
251244
$this->emitter->emitEvent('Test', 'test');
252-
253-
$this->addToAssertionCount(1);
254245
}
255246

256247

@@ -264,8 +255,6 @@ public function testRemoveKeepOtherScope(): void {
264255
$this->emitter->listen('Bar', 'test', $listener);
265256
$this->emitter->removeListener('Bar', 'test', $listener);
266257
$this->emitter->emitEvent('Test', 'test');
267-
268-
$this->addToAssertionCount(1);
269258
}
270259

271260

@@ -278,7 +267,5 @@ public function testRemoveNonExistingName(): void {
278267
$this->emitter->listen('Test', 'test', $listener);
279268
$this->emitter->removeListener('Bar', 'test', $listener);
280269
$this->emitter->emitEvent('Test', 'test');
281-
282-
$this->addToAssertionCount(1);
283270
}
284271
}

0 commit comments

Comments
 (0)