createMock(Configuration::class); $configuration->expects(self::atLeastOnce()) ->method('isAbortOnError') ->willReturn(false); $configuration->expects(self::atLeastOnce()) ->method('isSilentOnError') ->willReturn(true); $errorManager = new ErrorManager($configuration); $errorManager->error('ERROR FOO'); $errorManager->error('ERROR BAR'); $errors = $errorManager->getErrors(); self::assertSame('ERROR FOO', $errors[0]->asString()); self::assertSame('ERROR BAR', $errors[1]->asString()); } }