public function testEnableInvalidFlagThrowsInvalidArgumentException()
 {
     $flagName = 'foo';
     $this->setExpectedException('InvalidArgumentException', 'Flag "' . $flagName . '" is not valid', 1);
     $configuration = new Configuration();
     $configuration->enableFlag($flagName);
 }
 public function testLocalPathIsTranslatedToFileUrl()
 {
     $path = '/home/example/foo/.js';
     $expectedPath = 'file:' . $path;
     $configuration = new Configuration();
     $this->assertEquals($expectedPath, $configuration->setUrlToLint($path)->getUrlToLint());
 }
 public function setUp()
 {
     $key = str_replace('test', '', strtolower($this->getName()));
     $optionName = $this->options[$key];
     $optionValue = $this->values[$optionName];
     $configuration = new Configuration();
     $configuration->setOption($optionName, $optionValue);
 }
 public function setUp()
 {
     $key = str_replace('test', '', strtolower($this->getName()));
     $flagNames = $this->getAllFlagNames();
     $flagName = $flagNames[$key];
     $configuration = new Configuration();
     $configuration->enableFlag($flagName);
 }
 public function setUp()
 {
     $key = str_replace('test', '', strtolower($this->getName()));
     $flagName = $this->flags[$key];
     $configuration = new Configuration();
     $configuration->enableFlag($flagName);
     $configuration->unsetFlag($flagName);
     $this->assertFalse($configuration->hasFlag($flagName));
 }
 public function setUp()
 {
     $optionsAndValues = $this->getOptionsAndValues();
     $configuration = new Configuration();
     $configuration->setUrlToLint(self::URL_TO_LINT);
     foreach ($optionsAndValues as $optionName => $optionValue) {
         $configuration->setOption($optionName, $optionValue);
     }
     $this->assertEquals($this->getExpectedFlaglessExecutableCommandPrefix() . ' ' . $this->getExpectedOptionsString() . ' ' . $this->getExpectedExecutableCommandSuffix(), $configuration->getExecutableCommand());
 }
 public function setUp()
 {
     $flagsAndValues = $this->getFlagsAndValues();
     $configuration = new Configuration();
     $configuration->setUrlToLint(self::URL_TO_LINT);
     foreach ($flagsAndValues as $name => $value) {
         if ($value) {
             $configuration->enableFlag($name);
         } else {
             $configuration->disableFlag($name);
         }
     }
     $this->assertEquals($this->getExpectedExecutableCommandPrefix() . ' ' . $this->getExpectedFlagsString() . ' ' . $this->getExpectedExecutableCommandSuffix(), $configuration->getExecutableCommand());
 }
 public function testWithoutUrlToLintThrowsUnexpectedValueException()
 {
     $this->setExpectedException('UnexpectedValueException', 'URL to lint not present; set this first with ->setUrlToLint()', 1);
     $configuration = new Configuration();
     $configuration->getExecutableCommand();
 }
 public function testGetBeforeSetReturnsDefault()
 {
     $configuration = new Configuration();
     $this->assertEquals(Configuration::DEFAULT_NODE_JSLINT_PATH, $configuration->getNodeJslintPath());
 }
 public function testDefaultExecutableCommandContainsRemoteUrl()
 {
     $configuration = new Configuration();
     $configuration->setUrlToLint(self::URL_TO_LINT);
     $this->assertEquals($this->getExpectedFlaglessExecutableCommandPrefix() . ' ' . $this->getExpectedExecutableCommandSuffix(), $configuration->getExecutableCommand());
 }