Author: FrankStelzer
Date: 2010-02-28 14:32:33 +0100 (Sun, 28 Feb 2010)
New Revision: 28319

Added:
   plugins/sfPHPUnit2Plugin/trunk/data/template/unit/bootstrap_compat.tpl
   
plugins/sfPHPUnit2Plugin/trunk/lib/task/sfPHPUnitGenerateCompatTestTask.class.php
Modified:
   plugins/sfPHPUnit2Plugin/trunk/package.xml
Log:
[sfPHPUnit2Plugin] added compatibility task for symfony 1.2

Added: plugins/sfPHPUnit2Plugin/trunk/data/template/unit/bootstrap_compat.tpl
===================================================================
--- plugins/sfPHPUnit2Plugin/trunk/data/template/unit/bootstrap_compat.tpl      
                        (rev 0)
+++ plugins/sfPHPUnit2Plugin/trunk/data/template/unit/bootstrap_compat.tpl      
2010-02-28 13:32:33 UTC (rev 28319)
@@ -0,0 +1,24 @@
+<?php
+/*
+ * This file is part of the sfPHPUnit2Plugin package.
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * Idea taken from bootstrap/unit.php of the lime bootstrap file
+ */
+
+$_test_dir = realpath(dirname(__FILE__).'/../..');
+$_root_dir = $_test_dir.'/..';
+
+require_once($_root_dir.'/config/ProjectConfiguration.class.php');
+$configuration = new ProjectConfiguration($_root_dir);
+include($configuration->getSymfonyLibDir().'/vendor/lime/lime.php');
+
+
+// autoloader for sfPHPUnit2Plugin libs
+$autoload = sfSimpleAutoload::getInstance();
+$autoload->addDirectory($_root_dir . '/plugins/sfPHPUnit2Plugin/lib/config');
+$autoload->register();
+
+

Added: 
plugins/sfPHPUnit2Plugin/trunk/lib/task/sfPHPUnitGenerateCompatTestTask.class.php
===================================================================
--- 
plugins/sfPHPUnit2Plugin/trunk/lib/task/sfPHPUnitGenerateCompatTestTask.class.php
                           (rev 0)
+++ 
plugins/sfPHPUnit2Plugin/trunk/lib/task/sfPHPUnitGenerateCompatTestTask.class.php
   2010-02-28 13:32:33 UTC (rev 28319)
@@ -0,0 +1,57 @@
+<?php
+
+/*
+ * This file is part of the sfPHPUnit2Plugin package.
+ * (c) 2010 Frank Stelzer <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * Generates bootstrap files for PHPUnit testing within older symfony versions.
+ *
+ * @package    sfPHPUnit2Plugin
+ * @subpackage task
+ *
+ * @author     Frank Stelzer <[email protected]>
+ */
+class sfPHPUnitGenerateCompatTestTask extends sfPHPUnitGenerateBaseTask
+{
+  /**
+   * @see sfTask
+   */
+  protected function configure()
+  {
+    $this->namespace        = 'phpunit';
+    $this->name             = 'generate-compat';
+    $this->briefDescription = 'Generates bootstrap files for older symfony 
versions';
+    $this->detailedDescription = <<<EOF
+The [phpunit:generate-compat|INFO] generates bootstrap files for older symfony 
versions.
+
+Call it with:
+
+  [php symfony phpunit:generate-compat|INFO]
+EOF;
+  }
+
+   /**
+   * @see sfTask
+   */
+  protected function execute($arguments = array(), $options = array())
+  {
+    // create standard bootstrap files first
+    $this->createBootstrap();
+
+    // replace unit bootstrap file with the compat one
+    // the functional bootstrap file needs no overwritting
+    $template = $this->getTemplate('unit/bootstrap_compat.tpl');
+
+    $rendered = $this->renderTemplate($template, array());
+
+    $file = 'bootstrap/unit.php';
+    $this->saveFile($rendered, $file, array('overwrite' => true));
+
+    $this->logSection('file+', $file);
+  }
+}

Modified: plugins/sfPHPUnit2Plugin/trunk/package.xml
===================================================================
--- plugins/sfPHPUnit2Plugin/trunk/package.xml  2010-02-28 02:01:53 UTC (rev 
28318)
+++ plugins/sfPHPUnit2Plugin/trunk/package.xml  2010-02-28 13:32:33 UTC (rev 
28319)
@@ -1,112 +1,114 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<package packagerversion="1.4.6" version="2.0"
-       xmlns="http://pear.php.net/dtd/package-2.0"; 
xmlns:tasks="http://pear.php.net/dtd/tasks-1.0";
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-       xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 
http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 
http://pear.php.net/dtd/package-2.0.xsd";>
-       <name>sfPHPUnit2Plugin</name>
-       <channel>plugins.symfony-project.org</channel>
-       <summary>Plugin adding PHPUnit support to symfony</summary>
-       <description>The sfPHPUnit2Plugin adds PHPUnit support to 
symfony</description>
-       <lead>
-               <name>Frank Stelzer</name>
-               <user>FrankStelzer</user>
-               <email>[email protected]</email>
-               <active>yes</active>
-       </lead>
-       <date>2010-02-25</date>
-       <time>09:20:00</time>
-
-       <version>
-               <release>0.8.2</release>
-               <api>0.8.2</api>
-       </version>
-
-       <stability>
-               <release>beta</release>
-               <api>beta</api>
-       </stability>
-
-       <license uri="http://www.symfony-project.org/license";>MIT 
license</license>
-
-       <notes>-</notes>
-
-       <contents>
-               <dir name="/">
-                       <file role="data" name="README" />
-                       <file role="data" name="LICENSE" />
-                       <dir name="data">
-                               <dir name="template">
-                                       <dir name="functional">
-                                               <file role="data" 
name="bootstrap.tpl" />
-                                               <file role="data" 
name="functional_test.tpl" />
-                                       </dir>
-                                       <dir name="unit">
-                                               <file role="data" 
name="bootstrap.tpl" />
-                                               <file role="data" 
name="unit_test.tpl" />
-                                       </dir>
-                               </dir>
-                       </dir>
-                       <dir name="lib">
-                               <dir name="config">
-                                       <file role="data" name="autoload.yml" />
-                               </dir>
-                               <dir name="task">
-                                       <file role="data" 
name="sfPHPUnitBaseTask.class.php" />
-                                       <file role="data" 
name="sfPHPUnitFunctionalTask.class.php" />
-                                       <file role="data" 
name="sfPHPUnitGenerateBaseTask.class.php" />
-                                       <file role="data" 
name="sfPHPUnitGenerateFunctionalTestTask.class.php" />
-                                       <file role="data" 
name="sfPHPUnitGenerateUnitTestTask.class.php" />
-                                       <file role="data" 
name="sfPHPUnitTestAllTask.class.php" />
-                                       <file role="data" 
name="sfPHPUnitUnitTask.class.php" />
-                               </dir>
-                               <dir name="test">
-                                       <file role="data" 
name="sfPHPUnitBaseFunctionalTestCase.class.php" />
-                                       <file role="data" 
name="sfPHPUnitBaseTestCase.class.php" />
-                                       <file role="data" 
name="sfPHPUnitTest.class.php" />
-                               </dir>
-                       </dir>
-               </dir>
-       </contents>
-
-       <dependencies>
-               <required>
-                       <php>
-                               <min>5.1.0</min>
-                       </php>
-                       <pearinstaller>
-                               <min>1.4.1</min>
-                       </pearinstaller>
-                       <package>
-                               <name>symfony</name>
-                               <channel>pear.symfony-project.com</channel>
-                               <min>1.2.0</min>
-                               <max>1.5.0</max>
-                               <exclude>1.5.0</exclude>
-                       </package>
-               </required>
-       </dependencies>
-
-       <phprelease />
-
-       <changelog>
-
-               <release>
-                       <version>
-                               <release>0.8.2</release>
-                               <api>0.8.2</api>
-                       </version>
-                       <stability>
-                               <release>beta</release>
-                               <api>beta</api>
-                       </stability>
-                       <license 
uri="http://www.symfony-project.com/license";>MIT license</license>
-                       <date>2010-02-25</date>
-                       <license>MIT</license>
-                       <notes>
-                               * added installation instruction with stability 
option                  
-                               * FrankStelzer: first usable version added, 
with unit and functional test support
-                       </notes>
-               </release>
-
-       </changelog>
+<?xml version="1.0" encoding="UTF-8"?>
+<package packagerversion="1.4.6" version="2.0"
+       xmlns="http://pear.php.net/dtd/package-2.0"; 
xmlns:tasks="http://pear.php.net/dtd/tasks-1.0";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 
http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 
http://pear.php.net/dtd/package-2.0.xsd";>
+       <name>sfPHPUnit2Plugin</name>
+       <channel>plugins.symfony-project.org</channel>
+       <summary>Plugin adding PHPUnit support to symfony</summary>
+       <description>The sfPHPUnit2Plugin adds PHPUnit support to 
symfony</description>
+       <lead>
+               <name>Frank Stelzer</name>
+               <user>FrankStelzer</user>
+               <email>[email protected]</email>
+               <active>yes</active>
+       </lead>
+       <date>2010-02-25</date>
+       <time>09:20:00</time>
+
+       <version>
+               <release>0.8.2</release>
+               <api>0.8.2</api>
+       </version>
+
+       <stability>
+               <release>beta</release>
+               <api>beta</api>
+       </stability>
+
+       <license uri="http://www.symfony-project.org/license";>MIT 
license</license>
+
+       <notes>-</notes>
+
+       <contents>
+               <dir name="/">
+                       <file role="data" name="README" />
+                       <file role="data" name="LICENSE" />
+                       <dir name="data">
+                               <dir name="template">
+                                       <dir name="functional">
+                                               <file role="data" 
name="bootstrap.tpl" />
+                                               <file role="data" 
name="functional_test.tpl" />
+                                       </dir>
+                                       <dir name="unit">
+                                               <file role="data" 
name="bootstrap.tpl" />
+                                               <file role="data" 
name="bootstrap_compat.tpl" />
+                                               <file role="data" 
name="unit_test.tpl" />
+                                       </dir>
+                               </dir>
+                       </dir>
+                       <dir name="lib">
+                               <dir name="config">
+                                       <file role="data" name="autoload.yml" />
+                               </dir>
+                               <dir name="task">
+                                       <file role="data" 
name="sfPHPUnitBaseTask.class.php" />
+                                       <file role="data" 
name="sfPHPUnitFunctionalTask.class.php" />
+                                       <file role="data" 
name="sfPHPUnitGenerateBaseTask.class.php" />
+                                       <file role="data" 
name="sfPHPUnitGenerateCompatTask.class.php" />
+                                       <file role="data" 
name="sfPHPUnitGenerateFunctionalTestTask.class.php" />
+                                       <file role="data" 
name="sfPHPUnitGenerateUnitTestTask.class.php" />
+                                       <file role="data" 
name="sfPHPUnitTestAllTask.class.php" />
+                                       <file role="data" 
name="sfPHPUnitUnitTask.class.php" />
+                               </dir>
+                               <dir name="test">
+                                       <file role="data" 
name="sfPHPUnitBaseFunctionalTestCase.class.php" />
+                                       <file role="data" 
name="sfPHPUnitBaseTestCase.class.php" />
+                                       <file role="data" 
name="sfPHPUnitTest.class.php" />
+                               </dir>
+                       </dir>
+               </dir>
+       </contents>
+
+       <dependencies>
+               <required>
+                       <php>
+                               <min>5.1.0</min>
+                       </php>
+                       <pearinstaller>
+                               <min>1.4.1</min>
+                       </pearinstaller>
+                       <package>
+                               <name>symfony</name>
+                               <channel>pear.symfony-project.com</channel>
+                               <min>1.2.0</min>
+                               <max>1.5.0</max>
+                               <exclude>1.5.0</exclude>
+                       </package>
+               </required>
+       </dependencies>
+
+       <phprelease />
+
+       <changelog>
+
+               <release>
+                       <version>
+                               <release>0.8.2</release>
+                               <api>0.8.2</api>
+                       </version>
+                       <stability>
+                               <release>beta</release>
+                               <api>beta</api>
+                       </stability>
+                       <license 
uri="http://www.symfony-project.com/license";>MIT license</license>
+                       <date>2010-02-25</date>
+                       <license>MIT</license>
+                       <notes>
+                               * added installation instruction with stability 
option
+                               * FrankStelzer: first usable version added, 
with unit and functional test support
+                       </notes>
+               </release>
+
+       </changelog>
 </package>
\ No newline at end of file

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to