Skip to content

Commit a5d7d62

Browse files
committed
test: stops passing anonymous class
1 parent 34b0950 commit a5d7d62

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

tests/wpunit/ModelFactoryTest.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,7 @@ public function testDoesNotResolveInvokableClasses()
298298
$factory = new class(MockModelWithInvokableProperty::class) extends ModelFactory {
299299
public function definition(): array {
300300
return [
301-
'invokable' => new class extends MockInvokableClass {
302-
public function __invoke() {
303-
throw new \Exception('Invokable classes should not be resolved by factories.');
304-
}
305-
},
301+
'invokable' => new MockInvokableClass(),
306302
];
307303
}
308304
};
@@ -353,9 +349,11 @@ class MockModelWithDependency extends MockModel
353349
/**
354350
* @since 1.2.3
355351
*/
356-
abstract class MockInvokableClass
352+
class MockInvokableClass
357353
{
358-
abstract public function __invoke();
354+
public function __invoke() {
355+
throw new \Exception('Invokable classes should not be resolved by factories.');
356+
}
359357
}
360358

361359
/**

0 commit comments

Comments
 (0)