Development

/branches/1.3/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildAllReloadTestAllTask.class.php

You must first sign up to be able to contribute.

root/branches/1.3/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildAllReloadTestAllTask.class.php

Revision 23810, 3.7 kB (checked in by Kris.Wallsmith, 5 years ago)

[1.3] set svn:eol-style property to native and svn:keywords property to Id on all .php files

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1 <?php
2
3 /*
4  * This file is part of the symfony package.
5  * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
6  * (c) Jonathan H. Wage <jonwage@gmail.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 require_once(dirname(__FILE__).'/sfDoctrineBaseTask.class.php');
13
14 /**
15  * Drops Databases, Creates Databases, Generates Doctrine model, SQL, initializes database, load data and run
16  * all test suites
17  *
18  * @package    symfony
19  * @subpackage doctrine
20  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
21  * @author     Jonathan H. Wage <jonwage@gmail.com>
22  * @version    SVN: $Id$
23  *
24  * @deprecated Use doctrine:build and test:all instead
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 }
Note: See TracBrowser for help on using the browser.