Author: FrankStelzer
Date: 2010-02-28 14:48:26 +0100 (Sun, 28 Feb 2010)
New Revision: 28320

Modified:
   plugins/sfPHPUnit2Plugin/trunk/README
   plugins/sfPHPUnit2Plugin/trunk/data/template/unit/bootstrap.tpl
   plugins/sfPHPUnit2Plugin/trunk/data/template/unit/bootstrap_compat.tpl
   plugins/sfPHPUnit2Plugin/trunk/package.xml
Log:
[sfPHPUnit2Plugin] updated documentation for next release 0.8.3 and bootstrap 
cleanup

Modified: plugins/sfPHPUnit2Plugin/trunk/README
===================================================================
--- plugins/sfPHPUnit2Plugin/trunk/README       2010-02-28 13:32:33 UTC (rev 
28319)
+++ plugins/sfPHPUnit2Plugin/trunk/README       2010-02-28 13:48:26 UTC (rev 
28320)
@@ -1,210 +1,216 @@
-# sfPHPUnit2 plugin #
-
-The `sfPHPUnit2Plugin` is a symfony plugin that adds basic functionality for 
unit and functional testing with PHPUnit.
-
-Symfony 1.x provides lime as default testing framework, but this does not 
match to every company's testing guidelines.
-This plugin provides several tasks for generating PHPUnit test cases and for 
executing them. It mimics the lime
-usage, so that switching from lime tests is quite easy.
-
-## Requirements ##
-  * a symfony version greater equal 1.2 is required
-  * the PHPUnit command-line test runner has to be available as `phpunit` in 
the command line (PHPUnit is **not** bundled with this plugin)
-  * for running *all* tests PHPUnit 3.4 is required, otherwise this plugin is 
independant to the PHPUnit version
-
-## Installation ##
-This plugin is marked as **beta** currently. Therefore the stability option 
has to be added to the plugin installer
-
-        $ ./symfony plugin:install --stability=beta sfPHPUnit2Plugin
-
-## Generate test cases ##
-### Unit tests ###
-Generating a test case for a unit test:
-
-        $ ./symfony phpunit:generate-unit <name>
-        
-Creates a new file in *test/phpunit/unit/&lt;name&gt;Test.php*
-        
-### Functional tests ###        
-Generating a test case for a functional test:
-
-        $ ./symfony phpunit:generate-functional <application> <controller_name>
-        
-Creates a new file in 
*test/phpunit/functional/&lt;application&gt;/&lt;controller_name&gt;ActionsTest.php*.
-This generation is not done automatically when a new module is generated and 
has to be called by hand currently.
-
-### Options ###
-  * **overwrite**: An existing test case is not overwritten by default. 
Overwritting is enabled with this option.
-  * **dir** (unit test only): A subfolder the generated test case should be 
saved in.
-
-### Examples ###
-
-        $ #test/phpunit/unit/somesubfolder/SomeToolsTest.php
-        $ ./symfony phpunit:generate-unit --dir="somesubfolder" --overwrite 
SomeTools
-        
-        $ #test/phpunit/functional/frontend/homeActionsTest.php
-        $ ./symfony phpunit:generate-functional frontend home
-        
-## Usage ##
-### Unit tests ###
-The unit test given in the [official 
documenation](http://www.symfony-project.org/book/1_2/15-Unit-and-Functional-Testing#chapter_15_unit_tests
 "Unit and Functional Testing") would look like this:
-
-    <?php
-    require_once dirname(__FILE__).'/../bootstrap/unit.php';
-
-    class SomeTest extends sfPHPUnitBaseTestCase
-    {
-      protected function _start()
-      {
-        $this->getTest()->diag('test is starting');
-      }
-
-      protected function _end()
-      {
-        $this->getTest()->diag('test is ending');
-      }
-      
-      public function testStrtolower()
-      {
-        $t = $this->getTest();
-
-        // strtolower()
-        $t->diag('strtolower() ...');
-        $t->isa_ok(strtolower('Foo'), 'string',
-                   'strtolower() returns a string');
-        $t->is(strtolower('FOO'), 'foo',
-                   'strtolower() transforms the input to lowercase');
-        $t->is(strtolower('foo'), 'foo',
-                   'strtolower() leaves lowercase characters unchanged');
-        $t->is(strtolower('1...@~'), '1...@~',
-                   'strtolower() leaves non alphabetical characters 
unchanged');
-        $t->is(strtolower('FOO BAR'), 'foo bar',
-                   'strtolower() leaves blanks alone');
-        $t->is(strtolower('FoO bAr'), 'foo bar',
-                   'strtolower() deals with mixed case input');
-
-        $this->assertEquals('foo', strtolower('FOO'));
-      }
-    }
-    
-The **getTest** method returns a sfPHPUnitTest instance which mimics the lime 
interface. 
-This mechanism makes moving from an existing lime test quite easy. 
-Of course you can call the native PHPUnit API directly for making assertions.
-The base class for this test case is using the **setUp** and **tearDown** 
methods of PHPUnit for doing something just before and after every test.
-When you need some custom code during those test phases, please use the 
according **_start** and **_end** methods. 
-
-### Functional tests ###
-Here some content of a generated functional test:
-
-    <?php
-    require_once dirname(__FILE__).'/../../bootstrap/functional.php';
-
-    class functional_frontend_homeActionsTest extends 
sfPHPUnitBaseFunctionalTestCase
-    {
-      protected function getApplication()
-      {
-        return 'frontend';
-      }
-
-      public function testDefault()
-      {
-        $browser = $this->getBrowser();
-
-        $browser->
-          get('/home/index')->
-
-          with('request')->begin()->
-            isParameter('module', 'home')->
-            isParameter('action', 'index')->
-          end()->
-
-          with('response')->begin()->
-            isStatusCode(200)->
-            checkElement('body', '!/This is a temporary page/')->
-          end()
-        ;
-      }
-    }
-    
-As you can see, the main testing code is almost equal to the one of lime. 
-This could be realized, because the browser instance is linked here to the 
current PHPUnit test case and not to the lime test instance.
-Only the way the browser instance has to be fetched is different.
-        
-## Execute test cases ##
-### Unit tests ###
-Executing a unit test:
-
-        $ ./symfony phpunit:test-unit <name>
-        $ # equal to
-        $ phpunit test/phpunit/unit/<name>Test.php
-        
-When the name parameter is not given, all unit tests will be executed!
-
-### Functional tests ###
-Executing a functional test:
-
-        $ ./symfony phpunit:test-functional <application> <controller_name>
-        $ # equal to
-        $ phpunit 
test/phpunit/functional/<application>/<controller_name>ActionsTest.php
-        
-Both parameters are optional. When they are not given, all functional tests 
will be executed.
-
-### Options ###
-  * **options**: An option string which is directly passed to the command-line 
test runner of PHPUnit.
-  * **dir** (unit test only): The subfolder an existing unit test is located 
in.
-        
-### Examples ###
-Executing a unit test:
-
-        $ ./symfony phpunit:test-unit SomeTools
-        $ # equal to
-        $ phpunit test/phpunit/unit/SomeToolsTest.php
-        
-Executing a unit test from a subfolder:
-
-        $ ./symfony phpunit:test-unit --dir="somesubfolder" 
--options="--colors --verbose" SomeTools
-        $ # equal to
-        $ phpunit --colors --verbose 
test/phpunit/unit/somesubfolder/SomeToolsTest.php
-        
-Executing a functional test:
-
-        $ ./symfony phpunit:test-functional --options="--colors" frontend home
-        $ # equal to
-        $ phpunit --colors test/phpunit/functional/frontend/homeActionsTest.php
-        
-Executing all functional tests with process isolation (PHPUnit 3.4 required):
-
-        $ ./symfony phpunit:test-functional --options="--colors 
--process-isolation"
-        $ # equal to
-        $ phpunit --colors --process-isolation test/phpunit/functional
-        
-Executing all tests (process isolation option required!):
-
-        $ ./symfony phpunit:test-all --options="--colors --process-isolation"
-
-## Some Hints ##
-  * **Functional tests of several applications have to be run with the 
"process isolation" PHPUnit option (only available in PHPUnit 3.4)!**
-  * Use the *colors* option of PHPUnit to get a colorful representation of 
your test results
-  * You do not like the PHPUnit syntax? Use **$this->getTest()** to retrieve a 
instance of sfPHPUnitTest, which mimics the lime-like interface!
-  * Use the **_start** and **_end** methods for doing something just before 
and after a test (please do not overwrite the setUp and tearDown methods)!
-  * implement the **getApplication** method in your unit test and call 
**getContext** afterwards for creating an according sfContext instance
-  
-## Snippets ##
-Loading fixtures in your test:
-
-      protected function _start()
-      {
-        new 
sfDatabaseManager(ProjectConfiguration::getApplicationConfiguration('frontend', 
'test', true));
-        Doctrine_Core::loadData(sfConfig::get('sf_data_dir').'/fixtures');
-      }
-      
-Creating a sfContext instance in a unit test:
-
-      protected function getApplication()
-      {
-        return 'frontend';
-      }
-
-      public function testContext()
-      {
-        $this->assertEquals('frontend', 
$this->getContext()->getConfiguration()->getApplication());
+# sfPHPUnit2 plugin #
+
+The `sfPHPUnit2Plugin` is a symfony plugin that adds basic functionality for 
unit and functional testing with PHPUnit.
+
+Symfony 1.x provides lime as default testing framework, but this does not 
match to every company's testing guidelines.
+This plugin provides several tasks for generating PHPUnit test cases and for 
executing them. It mimics the lime
+usage, so that switching from lime tests is quite easy.
+
+## Requirements ##
+  * a symfony version greater equal 1.2 is required
+  * the PHPUnit command-line test runner has to be available as `phpunit` in 
the command line (PHPUnit is **not** bundled with this plugin)
+  * for running *all* tests PHPUnit 3.4 is required, otherwise this plugin is 
independant to the PHPUnit version
+
+## Installation ##
+This plugin is marked as **beta** currently. Therefore the stability option 
has to be added to the plugin installer
+
+        $ ./symfony plugin:install --stability=beta sfPHPUnit2Plugin
+
+## Generate test cases ##
+### Unit tests ###
+Generating a test case for a unit test:
+
+        $ ./symfony phpunit:generate-unit <name>
+
+Creates a new file in *test/phpunit/unit/&lt;name&gt;Test.php*
+
+An additional task for ***symfony 1.2*** projects has to be run which creates 
special bootstrap files
+
+        $ ./symfony phpunit:generate-compat
+
+This task has to be called at the very first time only.
+
+### Functional tests ###
+Generating a test case for a functional test:
+
+        $ ./symfony phpunit:generate-functional <application> <controller_name>
+
+Creates a new file in 
*test/phpunit/functional/&lt;application&gt;/&lt;controller_name&gt;ActionsTest.php*.
+This generation is not done automatically when a new module is generated and 
has to be called by hand currently.
+
+### Options ###
+  * **overwrite**: An existing test case is not overwritten by default. 
Overwritting is enabled with this option.
+  * **dir** (unit test only): A subfolder the generated test case should be 
saved in.
+
+### Examples ###
+
+        $ #test/phpunit/unit/somesubfolder/SomeToolsTest.php
+        $ ./symfony phpunit:generate-unit --dir="somesubfolder" --overwrite 
SomeTools
+
+        $ #test/phpunit/functional/frontend/homeActionsTest.php
+        $ ./symfony phpunit:generate-functional frontend home
+
+## Usage ##
+### Unit tests ###
+The unit test given in the [official 
documenation](http://www.symfony-project.org/book/1_2/15-Unit-and-Functional-Testing#chapter_15_unit_tests
 "Unit and Functional Testing") would look like this:
+
+    <?php
+    require_once dirname(__FILE__).'/../bootstrap/unit.php';
+
+    class SomeTest extends sfPHPUnitBaseTestCase
+    {
+      protected function _start()
+      {
+        $this->getTest()->diag('test is starting');
+      }
+
+      protected function _end()
+      {
+        $this->getTest()->diag('test is ending');
+      }
+
+      public function testStrtolower()
+      {
+        $t = $this->getTest();
+
+        // strtolower()
+        $t->diag('strtolower() ...');
+        $t->isa_ok(strtolower('Foo'), 'string',
+                   'strtolower() returns a string');
+        $t->is(strtolower('FOO'), 'foo',
+                   'strtolower() transforms the input to lowercase');
+        $t->is(strtolower('foo'), 'foo',
+                   'strtolower() leaves lowercase characters unchanged');
+        $t->is(strtolower('1...@~'), '1...@~',
+                   'strtolower() leaves non alphabetical characters 
unchanged');
+        $t->is(strtolower('FOO BAR'), 'foo bar',
+                   'strtolower() leaves blanks alone');
+        $t->is(strtolower('FoO bAr'), 'foo bar',
+                   'strtolower() deals with mixed case input');
+
+        $this->assertEquals('foo', strtolower('FOO'));
+      }
+    }
+
+The **getTest** method returns a sfPHPUnitTest instance which mimics the lime 
interface.
+This mechanism makes moving from an existing lime test quite easy.
+Of course you can call the native PHPUnit API directly for making assertions.
+The base class for this test case is using the **setUp** and **tearDown** 
methods of PHPUnit for doing something just before and after every test.
+When you need some custom code during those test phases, please use the 
according **_start** and **_end** methods.
+
+### Functional tests ###
+Here some content of a generated functional test:
+
+    <?php
+    require_once dirname(__FILE__).'/../../bootstrap/functional.php';
+
+    class functional_frontend_homeActionsTest extends 
sfPHPUnitBaseFunctionalTestCase
+    {
+      protected function getApplication()
+      {
+        return 'frontend';
+      }
+
+      public function testDefault()
+      {
+        $browser = $this->getBrowser();
+
+        $browser->
+          get('/home/index')->
+
+          with('request')->begin()->
+            isParameter('module', 'home')->
+            isParameter('action', 'index')->
+          end()->
+
+          with('response')->begin()->
+            isStatusCode(200)->
+            checkElement('body', '!/This is a temporary page/')->
+          end()
+        ;
+      }
+    }
+
+As you can see, the main testing code is almost equal to the one of lime.
+This could be realized, because the browser instance is linked here to the 
current PHPUnit test case and not to the lime test instance.
+Only the way the browser instance has to be fetched is different.
+
+## Execute test cases ##
+### Unit tests ###
+Executing a unit test:
+
+        $ ./symfony phpunit:test-unit <name>
+        $ # equal to
+        $ phpunit test/phpunit/unit/<name>Test.php
+
+When the name parameter is not given, all unit tests will be executed!
+
+### Functional tests ###
+Executing a functional test:
+
+        $ ./symfony phpunit:test-functional <application> <controller_name>
+        $ # equal to
+        $ phpunit 
test/phpunit/functional/<application>/<controller_name>ActionsTest.php
+
+Both parameters are optional. When they are not given, all functional tests 
will be executed.
+
+### Options ###
+  * **options**: An option string which is directly passed to the command-line 
test runner of PHPUnit.
+  * **dir** (unit test only): The subfolder an existing unit test is located 
in.
+
+### Examples ###
+Executing a unit test:
+
+        $ ./symfony phpunit:test-unit SomeTools
+        $ # equal to
+        $ phpunit test/phpunit/unit/SomeToolsTest.php
+
+Executing a unit test from a subfolder:
+
+        $ ./symfony phpunit:test-unit --dir="somesubfolder" 
--options="--colors --verbose" SomeTools
+        $ # equal to
+        $ phpunit --colors --verbose 
test/phpunit/unit/somesubfolder/SomeToolsTest.php
+
+Executing a functional test:
+
+        $ ./symfony phpunit:test-functional --options="--colors" frontend home
+        $ # equal to
+        $ phpunit --colors test/phpunit/functional/frontend/homeActionsTest.php
+
+Executing all functional tests with process isolation (PHPUnit 3.4 required):
+
+        $ ./symfony phpunit:test-functional --options="--colors 
--process-isolation"
+        $ # equal to
+        $ phpunit --colors --process-isolation test/phpunit/functional
+
+Executing all tests (process isolation option required!):
+
+        $ ./symfony phpunit:test-all --options="--colors --process-isolation"
+
+## Some Hints ##
+  * **Functional tests of several applications have to be run with the 
"process isolation" PHPUnit option (only available in PHPUnit 3.4)!**
+  * Use the *colors* option of PHPUnit to get a colorful representation of 
your test results
+  * You do not like the PHPUnit syntax? Use **$this->getTest()** to retrieve a 
instance of sfPHPUnitTest, which mimics the lime-like interface!
+  * Use the **_start** and **_end** methods for doing something just before 
and after a test (please do not overwrite the setUp and tearDown methods)!
+  * implement the **getApplication** method in your unit test and call 
**getContext** afterwards for creating an according sfContext instance
+
+## Snippets ##
+Loading fixtures in your test:
+
+      protected function _start()
+      {
+        new 
sfDatabaseManager(ProjectConfiguration::getApplicationConfiguration('frontend', 
'test', true));
+        Doctrine_Core::loadData(sfConfig::get('sf_data_dir').'/fixtures');
+      }
+
+Creating a sfContext instance in a unit test:
+
+      protected function getApplication()
+      {
+        return 'frontend';
+      }
+
+      public function testContext()
+      {
+        $this->assertEquals('frontend', 
$this->getContext()->getConfiguration()->getApplication());
       }
\ No newline at end of file

Modified: plugins/sfPHPUnit2Plugin/trunk/data/template/unit/bootstrap.tpl
===================================================================
--- plugins/sfPHPUnit2Plugin/trunk/data/template/unit/bootstrap.tpl     
2010-02-28 13:32:33 UTC (rev 28319)
+++ plugins/sfPHPUnit2Plugin/trunk/data/template/unit/bootstrap.tpl     
2010-02-28 13:48:26 UTC (rev 28320)
@@ -1,29 +1,30 @@
-<?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.'/..';
-// configuration
-require_once $_root_dir.'/config/ProjectConfiguration.class.php';
-$configuration = ProjectConfiguration::hasActive() ? 
ProjectConfiguration::getActive() : new 
ProjectConfiguration(realpath($_root_dir));
-
-// lime
-require_once $configuration->getSymfonyLibDir().'/vendor/lime/lime.php';
-
-// autoloader
-$autoload = 
sfSimpleAutoload::getInstance(sfConfig::get('sf_cache_dir').'/project_autoload.cache');
-$autoload->loadConfiguration(sfFinder::type('file')->name('autoload.yml')->in(array(
-  sfConfig::get('sf_symfony_lib_dir').'/config/config',
-  sfConfig::get('sf_config_dir'),
-  $_root_dir . '/plugins/sfPHPUnit2Plugin/lib/config'
-)));
-$autoload->register();
-
-
+<?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.'/..';
+
+// configuration
+require_once $_root_dir.'/config/ProjectConfiguration.class.php';
+$configuration = ProjectConfiguration::hasActive() ? 
ProjectConfiguration::getActive() : new 
ProjectConfiguration(realpath($_root_dir));
+
+// lime
+require_once $configuration->getSymfonyLibDir().'/vendor/lime/lime.php';
+
+// autoloader for sfPHPUnit2Plugin libs
+$autoload = 
sfSimpleAutoload::getInstance(sfConfig::get('sf_cache_dir').'/project_autoload.cache');
+$autoload->loadConfiguration(sfFinder::type('file')->name('autoload.yml')->in(array(
+  sfConfig::get('sf_symfony_lib_dir').'/config/config',
+  sfConfig::get('sf_config_dir'),
+  $_root_dir . '/plugins/sfPHPUnit2Plugin/lib/config'
+)));
+$autoload->register();
+
+

Modified: plugins/sfPHPUnit2Plugin/trunk/data/template/unit/bootstrap_compat.tpl
===================================================================
--- plugins/sfPHPUnit2Plugin/trunk/data/template/unit/bootstrap_compat.tpl      
2010-02-28 13:32:33 UTC (rev 28319)
+++ plugins/sfPHPUnit2Plugin/trunk/data/template/unit/bootstrap_compat.tpl      
2010-02-28 13:48:26 UTC (rev 28320)
@@ -11,8 +11,11 @@
 $_test_dir = realpath(dirname(__FILE__).'/../..');
 $_root_dir = $_test_dir.'/..';
 
+// configuration
 require_once($_root_dir.'/config/ProjectConfiguration.class.php');
 $configuration = new ProjectConfiguration($_root_dir);
+
+// lime
 include($configuration->getSymfonyLibDir().'/vendor/lime/lime.php');
 
 

Modified: plugins/sfPHPUnit2Plugin/trunk/package.xml
===================================================================
--- plugins/sfPHPUnit2Plugin/trunk/package.xml  2010-02-28 13:32:33 UTC (rev 
28319)
+++ plugins/sfPHPUnit2Plugin/trunk/package.xml  2010-02-28 13:48:26 UTC (rev 
28320)
@@ -13,12 +13,12 @@
                <email>[email protected]</email>
                <active>yes</active>
        </lead>
-       <date>2010-02-25</date>
-       <time>09:20:00</time>
+       <date>2010-03-01</date>
+       <time>10:00:00</time>
 
        <version>
-               <release>0.8.2</release>
-               <api>0.8.2</api>
+               <release>0.8.3</release>
+               <api>0.8.3</api>
        </version>
 
        <stability>
@@ -94,6 +94,23 @@
 
                <release>
                        <version>
+                               <release>0.8.3</release>
+                               <api>0.8.3</api>
+                       </version>
+                       <stability>
+                               <release>beta</release>
+                               <api>beta</api>
+                       </stability>
+                       <license 
uri="http://www.symfony-project.com/license";>MIT license</license>
+                       <date>2010-03-01</date>
+                       <license>MIT</license>
+                       <notes>
+                               * added compatibility task for symfony 1.2
+                       </notes>
+               </release>
+
+               <release>
+                       <version>
                                <release>0.8.2</release>
                                <api>0.8.2</api>
                        </version>

-- 
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