/** * @param string $analyzerName * @return EventManager * @throws \Webiny\Component\EventManager\EventManagerException */ protected function getEventManager($analyzerName) { if (!class_exists($analyzerName, true)) { throw new \InvalidArgumentException("Analyzer with name: {$analyzerName} doesnot exist"); } /** @var \PHPSA\Analyzer\Pass\Metadata $metaData */ $metaData = $analyzerName::getMetadata(); if (!$metaData->allowsPhpVersion(PHP_VERSION)) { parent::markTestSkipped(sprintf('We cannot tests %s with %s because PHP required version is %s', $analyzerName, PHP_VERSION, $metaData->getRequiredPhpVersion())); } $analyzerConfiguration = $metaData->getConfiguration(); $analyzerConfiguration->attribute('enabled', true); $config = [$analyzerName::getMetadata()->getConfiguration()]; $em = EventManager::getInstance(); $configuration = new Configuration([], $config); \PHPSA\Analyzer\Factory::factory($em, $configuration); return $em; }