setTargetFile() does not need to check for existing file.

This commit is contained in:
Peter Breuls 2013-05-10 21:19:31 +02:00
parent c2c96c7079
commit 0ec5686518
2 changed files with 3 additions and 8 deletions

View file

@ -186,11 +186,7 @@ class ClosureCompiler
public function setTargetFile($file) public function setTargetFile($file)
{ {
$path = $this->config['targetBaseDir'] . $file; $path = $this->config['targetBaseDir'] . $file;
if (file_exists($path)) {
$this->config['targetFileName'] = $path; $this->config['targetFileName'] = $path;
} else {
throw new CompilerException("The path '{$path}' does not seem to exist.");
}
} }
/** /**

View file

@ -208,13 +208,12 @@ class closureCompilerTest extends PHPUnit_Framework_TestCase
/** /**
* @covers Devize\ClosureCompiler\ClosureCompiler::setTargetFile * @covers Devize\ClosureCompiler\ClosureCompiler::setTargetFile
* @expectedException Devize\ClosureCompiler\CompilerException
* @expectedExceptionMessage The path 'test.js' does not seem to exist.
*/ */
public function testSetTargetFile1() public function testSetTargetFile1()
{ {
$this->object->setTargetFile('test.js'); $this->object->setTargetFile('test.js');
$result = $this->object->getConfig();
$this->assertEquals($result['targetBaseDir'] . 'test.js', $result['targetFileName']);
} }
/** /**