File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 9
9
use Codeception \Stub \StubMarshaler ;
10
10
use Exception ;
11
11
use LogicException ;
12
- use PHPUnit \Framework \MockObject \Generator ;
12
+ use PHPUnit \Framework \MockObject \Generator as LegacyGenerator ;
13
+ use PHPUnit \Framework \MockObject \Generator \Generator ;
13
14
use PHPUnit \Framework \MockObject \MockObject as PHPUnitMockObject ;
14
15
use PHPUnit \Framework \MockObject \Rule \AnyInvokedCount ;
15
16
use PHPUnit \Framework \MockObject \Stub \ConsecutiveCalls ;
@@ -433,7 +434,12 @@ private static function doGenerateMock($args, $isAbstract = false)
433
434
{
434
435
$ testCase = self ::extractTestCaseFromArgs ($ args );
435
436
$ methodName = $ isAbstract ? 'getMockForAbstractClass ' : 'getMock ' ;
436
- $ generatorClass = new Generator ;
437
+ // PHPUnit 10.3 changed the namespace
438
+ if (version_compare (PHPUnitVersion::series (), '10.3 ' , '>= ' )) {
439
+ $ generatorClass = new Generator ();
440
+ } else {
441
+ $ generatorClass = new LegacyGenerator ();
442
+ }
437
443
438
444
// using PHPUnit 5.4 mocks registration
439
445
if (version_compare (PHPUnitVersion::series (), '5.4 ' , '>= ' )
You can’t perform that action at this time.
0 commit comments