getMockBuilder(KernelTestBase::class) ->disableOriginalConstructor() ->getMockForAbstractClass(); $is_isolated = new \ReflectionMethod($kernel_test, 'isTestInIsolation'); $is_isolated->setAccessible(TRUE); // Assert that the return value is a bool, because this unit test might or // might not be running in process isolation. $this->assertInternalType('bool', $is_isolated->invoke($kernel_test)); } }