Add exception if less file doest not exists or destination dir is not writable

Fix tests
This commit is contained in:
Nicolas Le Goff
2013-06-12 15:22:20 +02:00
parent d39736d278
commit 853477177b
2 changed files with 12 additions and 2 deletions

View File

@@ -47,6 +47,16 @@ class LessCompiler extends Command
foreach ($files as $lessFile => $buildFile) {
$this->container['filesystem']->mkdir(dirname($buildFile));
$output->writeln(sprintf('Building %s', basename($lessFile)));
if (!is_file($lessFile)) {
throw new \Exception(realpath($lessFile) . ' does not exists');
}
if (!is_writable(dirname($buildFile))) {
throw new \Exception(realpath(dirname($buildFile)) . ' is not writable');
}
$builder = ProcessBuilder::create(array(
'recess',
'--compile',

View File

@@ -51,7 +51,7 @@ class PhraseaRegisterFormTest extends FormTestCase
$form = new PhraseaRegisterForm(self::$DI['app'], $available, $params, new Camelizer());
$this->assertCount(9, self::$DI['app']->form($form)->createView()->vars['form']->children);
$this->assertCount(8, self::$DI['app']->form($form)->createView()->vars['form']->children);
}
public function testFormDoesNotRegisterNonValidFields()
@@ -75,6 +75,6 @@ class PhraseaRegisterFormTest extends FormTestCase
$form = new PhraseaRegisterForm(self::$DI['app'], $available, $params, new Camelizer());
$this->assertCount(8, self::$DI['app']->form($form)->createView()->vars['form']->children);
$this->assertCount(7, self::$DI['app']->form($form)->createView()->vars['form']->children);
}
}