/** * Tests that the convert util recognizes the imageConvert configuration * for the font-size: * * @return void */ public function testConvertRecognizesFontSizeInConfiguration() { $settings = new \stdClass(); $settings->imageConvert = new \stdClass(); $settings->imageConvert->fontSize = 14; $config = new Configuration($settings); ConfigurationInstance::set($config); $input = self::createInputSvg(); $output = self::createRunResourceURI('pdepend.svg'); ImageConvert::convert($input, $output); $svg = file_get_contents($output); $this->assertEquals(25, substr_count($svg, 'font-size:14px')); }
/** * Assign CLI arguments to current runner instance * * @return bool */ protected function assignArguments() { if ($this->source) { $this->runner->setSourceArguments($this->source); } // Check for suffix option if (isset($this->options['--suffix'])) { // Get file extensions $extensions = explode(',', $this->options['--suffix']); // Set allowed file extensions $this->runner->setFileExtensions($extensions); unset($this->options['--suffix']); } // Check for ignore option if (isset($this->options['--ignore'])) { // Get exclude directories $directories = explode(',', $this->options['--ignore']); // Set exclude directories $this->runner->setExcludeDirectories($directories); unset($this->options['--ignore']); } // Check for exclude namespace option if (isset($this->options['--exclude'])) { // Get exclude directories $namespaces = explode(',', $this->options['--exclude']); // Set exclude namespace $this->runner->setExcludeNamespaces($namespaces); unset($this->options['--exclude']); } // Check for the bad documentation option if (isset($this->options['--bad-documentation'])) { echo "Option --bad-documentation is ambiguous.", PHP_EOL; unset($this->options['--bad-documentation']); } $configuration = $this->application->getConfiguration(); // Store in config registry ConfigurationInstance::set($configuration); if (isset($this->options['--debug'])) { unset($this->options['--debug']); Log::setSeverity(Log::DEBUG); } }
/** * Tests that the command sets a configuration instance for a specified * config file. * * @return void */ public function testCommandHandlesConfigurationFileCorrect() { // Sample config file $configFile = self::createRunResourceURI('config.xml'); // Write a dummy config file. file_put_contents($configFile, '<?xml version="1.0"?> <symfony:container xmlns:symfony="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://pdepend.org/schema/dic/pdepend" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> <config> <cache> <driver>memory</driver> </cache> </config> </symfony:container>'); $argv = array('--configuration=' . $configFile, '--dummy-logger=' . self::createRunResourceURI(), __FILE__); // Result previous instance ConfigurationInstance::set(null); $this->executeCommand($argv); $config = ConfigurationInstance::get(); $this->assertEquals('memory', $config->cache->driver); }