public function testEnable() { $values = array('property.public' => array('enabled' => false), 'dependency.strongCoupling' => array('enabled' => true, 'excludePatterns' => array('foo'))); $handler = new ConfigurationHandler($values, new ObjectTypes()); $handler->configure($this->analyzer); $this->assertNotHasVisitor('Solidifier\\Visitors\\Encapsulation\\PublicAttributes'); $this->assertHasVisitor('Solidifier\\Visitors\\DependencyInjection\\StrongCoupling'); }
private function initializeServices() { $this['configuration'] = function ($c) { $configuration = array(); $filename = '.solidifier.yml'; $fs = $c['filesystem']; if ($fs->has($filename)) { $configuration = Yaml::parse($fs->read($filename)); } return $configuration; }; $this['event.dispatcher'] = function ($c) { return new EventDispatcher(); }; $this['dispatcher'] = function ($c) { return new Dispatchers\EventDispatcher($c['event.dispatcher']); }; $this['analyzer'] = function ($c) { $analyzer = new Analyzers\Analyzer($c['dispatcher'], $c['filesystem']); $handler = new ConfigurationHandler($c['configuration'], $c['objectTypes.list']); $handler->configure($analyzer); return $analyzer; }; $this['twig.path'] = 'views'; $this['twig.cache'] = false; $this['twig.debug'] = true; $this['twig'] = function ($c) { $loader = new \Twig_Loader_Filesystem($c['twig.path']); $twig = new \Twig_Environment($loader, array('cache' => $c['twig.cache'], 'debug' => $c['twig.debug'])); if ($c['twig.debug'] === true) { $twig->addExtension(new \Twig_Extension_Debug()); } return $twig; }; $this['objectTypes.list'] = function ($c) { return new ObjectTypes(); }; }