[DoctrineBundle] fixed CS

This commit is contained in:
Fabien Potencier 2011-05-01 10:39:54 +02:00
parent 74a243bdd6
commit 6edb6447c8
6 changed files with 20 additions and 23 deletions

View File

@ -71,7 +71,8 @@ EOT
$output->writeln(sprintf('<error>%s</error>', $e->getMessage()));
}
} else {
$output->writeln('<error>ATTENTION:</error> This operation should not be executed in a production environment.' . PHP_EOL);
$output->writeln('<error>ATTENTION:</error> This operation should not be executed in a production environment.');
$output->writeln('');
$output->writeln(sprintf('<info>Would drop the database named <comment>%s</comment>.</info>', $name));
$output->writeln('Please run the operation with --force to execute');
$output->writeln('<error>All data will be lost!</error>');

View File

@ -65,16 +65,14 @@ EOT
}
if (strpos($metadata->name, $foundBundle->getNamespace()) === false) {
throw new \RuntimeException(
"Entity " . $metadata->name . " and bundle don't have a common namespace, ".
"generation failed because the target directory cannot be detected.");
throw new \RuntimeException(sprintf('Entity "%s" and bundle don\'t have a common namespace, generation failed because the target directory cannot be detected.', $metadata->name));
}
$output->writeln(sprintf(' > generating <comment>%s</comment>', $metadata->name));
$entityGenerator->generate(array($metadata), $this->findBasePathForBundle($foundBundle));
}
} else {
throw new \RuntimeException("Bundle " . $bundleName . " does not contain any mapped entities.");
throw new \RuntimeException(sprintf('Bundle "%s" does not contain any mapped entities.', $bundleName));
}
}
}

View File

@ -59,9 +59,7 @@ EOT
if ($metadata->customRepositoryClassName) {
if (strpos($metadata->customRepositoryClassName, $foundBundle->getNamespace()) === false) {
throw new \RuntimeException(
"Repository " . $metadata->customRepositoryClassName . " and bundle don't have a common namespace, ".
"generation failed because the target directory cannot be detected.");
throw new \RuntimeException(sprintf('Repository "%s" and bundle don\'t have a common namespace, generation failed because the target directory cannot be detected.', $metadata->customRepositoryClassName));
}
$output->writeln(sprintf(' > <info>OK</info> generating <comment>%s</comment>', $metadata->customRepositoryClassName));
@ -71,7 +69,7 @@ EOT
}
}
} else {
throw new \RuntimeException("Bundle " . $bundleName . " does not contain any mapped entities.");
throw new \RuntimeException(sprintf('Bundle "%s" does not contain any mapped entities.', $bundleName));
}
}
}

View File

@ -103,7 +103,8 @@ EOT
file_put_contents($path, $code);
}
} else {
$output->writeln('Database does not have any mapping information.'.PHP_EOL, 'ERROR');
$output->writeln('Database does not have any mapping information.', 'ERROR');
$output->writeln('', 'ERROR');
}
}
}

View File

@ -64,17 +64,16 @@ EOT
);
}
$output->write(sprintf("Found <info>%d</info> entities mapped in entity manager <info>%s</info>:\n",
count($entityClassNames), $entityManagerName), true);
$output->writeln(sprintf("Found <info>%d</info> entities mapped in entity manager <info>%s</info>:", count($entityClassNames), $entityManagerName));
foreach ($entityClassNames as $entityClassName) {
try {
$cm = $entityManager->getClassMetadata($entityClassName);
$output->write("<info>[OK]</info> " . $entityClassName, true);
$output->writeln(sprintf("<info>[OK]</info> %s", $entityClassName));
} catch (MappingException $e) {
$output->write("<error>[FAIL]</error> " . $entityClassName, true);
$output->write("<comment>" . $e->getMessage()."</comment>", true);
$output->write("", true);
$output->writeln("<error>[FAIL]</error> ".$entityClassName);
$output->writeln(sprintf("<comment>%s</comment>", $e->getMessage()));
$output->writeln('');
}
}
}

View File

@ -16,11 +16,11 @@ class InfoDoctrineCommandTest extends TestCase
$input = new StringInput("doctrine:mapping:info");
$output = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
$output->expects($this->at(0))
->method('write')
->with($this->equalTo("Found <info>1</info> entities mapped in entity manager <info>default</info>:\n"), $this->equalTo(true));
->method('writeln')
->with($this->equalTo("Found <info>1</info> entities mapped in entity manager <info>default</info>:"));
$output->expects($this->at(1))
->method('write')
->with($this->equalTo("<info>[OK]</info> Fixtures\Bundles\YamlBundle\Entity\Test"), $this->equalTo(true));
->method('writeln')
->with($this->equalTo("<info>[OK]</info> Fixtures\Bundles\YamlBundle\Entity\Test"));
$testContainer = $this->createYamlBundleTestContainer();
$kernel = $this->getMock('Symfony\Component\HttpKernel\Kernel', array(), array(), '', false);