| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
require_once(dirname(__FILE__).'/sfDoctrineBaseTask.class.php'); |
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
class sfDoctrineBuildAllReloadTestAllTask extends sfDoctrineBaseTask |
|---|
| 27 |
{ |
|---|
| 28 |
|
|---|
| 29 |
* @see sfTask |
|---|
| 30 |
*/ |
|---|
| 31 |
protected function configure() |
|---|
| 32 |
{ |
|---|
| 33 |
$this->addOptions(array( |
|---|
| 34 |
new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', true), |
|---|
| 35 |
new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), |
|---|
| 36 |
new sfCommandOption('no-confirmation', null, sfCommandOption::PARAMETER_NONE, 'Do not ask for confirmation'), |
|---|
| 37 |
new sfCommandOption('skip-forms', 'F', sfCommandOption::PARAMETER_NONE, 'Skip generating forms'), |
|---|
| 38 |
new sfCommandOption('migrate', null, sfCommandOption::PARAMETER_NONE, 'Migrate instead of reset the database'), |
|---|
| 39 |
new sfCommandOption('dir', null, sfCommandOption::PARAMETER_REQUIRED | sfCommandOption::IS_ARRAY, 'The directories to look for fixtures'), |
|---|
| 40 |
new sfCommandOption('append', null, sfCommandOption::PARAMETER_NONE, 'Don\'t delete current data in the database'), |
|---|
| 41 |
)); |
|---|
| 42 |
|
|---|
| 43 |
$this->aliases = array('doctrine-build-all-reload-test-all'); |
|---|
| 44 |
$this->namespace = 'doctrine'; |
|---|
| 45 |
$this->name = 'build-all-reload-test-all'; |
|---|
| 46 |
$this->briefDescription = 'Generates Doctrine model, SQL, initializes database, load data and run all tests'; |
|---|
| 47 |
|
|---|
| 48 |
$this->detailedDescription = <<<EOF |
|---|
| 49 |
The [doctrine:build-all-reload|INFO] task is a shortcut for four other tasks: |
|---|
| 50 |
|
|---|
| 51 |
[./symfony doctrine:build-all-reload-test-all frontend|INFO] |
|---|
| 52 |
|
|---|
| 53 |
The task is equivalent to: |
|---|
| 54 |
|
|---|
| 55 |
[./symfony doctrine:drop-db|INFO] |
|---|
| 56 |
[./symfony doctrine:build-db|INFO] |
|---|
| 57 |
[./symfony doctrine:build-model|INFO] |
|---|
| 58 |
[./symfony doctrine:insert-sql|INFO] |
|---|
| 59 |
[./symfony doctrine:data-load|INFO] |
|---|
| 60 |
[./symfony test-all|INFO] |
|---|
| 61 |
|
|---|
| 62 |
The task takes an application argument because of the [doctrine:data-load|COMMENT] |
|---|
| 63 |
task. See [doctrine:data-load|COMMENT] help page for more information. |
|---|
| 64 |
|
|---|
| 65 |
Include the [--migrate|COMMENT] option if you would like to run your project's |
|---|
| 66 |
migrations rather than inserting the Doctrine SQL. |
|---|
| 67 |
|
|---|
| 68 |
[./symfony doctrine:build-all-reload-test-all --migrate|INFO] |
|---|
| 69 |
EOF; |
|---|
| 70 |
} |
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 |
* @see sfTask |
|---|
| 74 |
*/ |
|---|
| 75 |
protected function execute($arguments = array(), $options = array()) |
|---|
| 76 |
{ |
|---|
| 77 |
$buildAllReload = new sfDoctrineBuildAllReloadTask($this->dispatcher, $this->formatter); |
|---|
| 78 |
$buildAllReload->setCommandApplication($this->commandApplication); |
|---|
| 79 |
$buildAllReload->setConfiguration($this->configuration); |
|---|
| 80 |
$ret = $buildAllReload->run(array(), array( |
|---|
| 81 |
'dir' => $options['dir'], |
|---|
| 82 |
'append' => $options['append'], |
|---|
| 83 |
'skip-forms' => $options['skip-forms'], |
|---|
| 84 |
'no-confirmation' => $options['no-confirmation'], |
|---|
| 85 |
'migrate' => $options['migrate'], |
|---|
| 86 |
)); |
|---|
| 87 |
|
|---|
| 88 |
if ($ret) |
|---|
| 89 |
{ |
|---|
| 90 |
return $ret; |
|---|
| 91 |
} |
|---|
| 92 |
|
|---|
| 93 |
$this->logSection('doctrine', 'running test suite'); |
|---|
| 94 |
|
|---|
| 95 |
$testAll = new sfTestAllTask($this->dispatcher, $this->formatter); |
|---|
| 96 |
$testAll->setCommandApplication($this->commandApplication); |
|---|
| 97 |
$testAll->setConfiguration($this->configuration); |
|---|
| 98 |
$testAll->run(); |
|---|
| 99 |
} |
|---|
| 100 |
} |
|---|