@@ -376,6 +376,36 @@ public function testCallBeforeAndAfterClassWithBenchmarkExecutorWhenCustomSubjec
376376 self ::assertTrue ($ this ->executor ->hasMethodBeenExecuted ('afterClass ' ), 'after ' );
377377 }
378378
379+ public function testRunSubjectsWithDifferentExecutors (): void
380+ {
381+ TestUtil::configureBenchmarkMetadata ($ this ->benchmark , []);
382+
383+ $ subject1 = new SubjectMetadata ($ this ->benchmark ->reveal (), 'name ' );
384+ $ subject1 ->setExecutor (new ExecutorMetadata ('executor_1 ' , []));
385+ $ subject2 = new SubjectMetadata ($ this ->benchmark ->reveal (), 'name ' );
386+ $ subject2 ->setExecutor (new ExecutorMetadata ('executor_2 ' , []));
387+ $ this ->benchmark ->getSubjects ()->willReturn ([
388+ $ subject1 ,
389+ $ subject2 ,
390+ ]);
391+
392+ $ executor1 = new TestExecutor ();
393+ $ executor2 = new TestExecutor ();
394+ $ this ->executorRegistry ->getService ('executor_1 ' )->willReturn ($ executor1 );
395+ $ this ->executorRegistry ->getService ('executor_2 ' )->willReturn ($ executor2 );
396+ $ this ->executorRegistry ->getConfig (['executor ' => 'executor_1 ' ])->willReturn ($ this ->resolveExecutorConfig ([
397+ 'executor ' => 'executor_1 '
398+ ]));
399+ $ this ->executorRegistry ->getConfig (['executor ' => 'executor_2 ' ])->willReturn ($ this ->resolveExecutorConfig ([
400+ 'executor ' => 'executor_2 '
401+ ]));
402+
403+ $ this ->runner ->run ([ $ this ->benchmark ->reveal () ], RunnerConfig::create ());
404+
405+ self ::assertEquals (1 , $ executor1 ->getExecutedContextCount ());
406+ self ::assertEquals (1 , $ executor2 ->getExecutedContextCount ());
407+ }
408+
379409 /**
380410 * It should handle exceptions thrown by the executor.
381411 * It should handle nested exceptions.
0 commit comments