web/lib/Zend/Tool/Project/Provider/Project.php
changeset 807 877f952ae2bd
parent 207 621fa6caec0c
child 1230 68c69c656a2c
--- a/web/lib/Zend/Tool/Project/Provider/Project.php	Thu Mar 21 17:31:31 2013 +0100
+++ b/web/lib/Zend/Tool/Project/Provider/Project.php	Thu Mar 21 19:50:53 2013 +0100
@@ -15,9 +15,9 @@
  * @category   Zend
  * @package    Zend_Tool
  * @subpackage Framework
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: Project.php 20898 2010-02-04 07:03:46Z ralph $
+ * @version    $Id: Project.php 24593 2012-01-05 20:35:02Z matthew $
  */
 
 /**
@@ -28,7 +28,7 @@
 /**
  * @category   Zend
  * @package    Zend_Tool
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 class Zend_Tool_Project_Provider_Project
@@ -91,13 +91,18 @@
         $newProfile->loadFromData();
 
         $response = $this->_registry->getResponse();
-        
+
         $response->appendContent('Creating project at ' . $path);
         $response->appendContent('Note: ', array('separator' => false, 'color' => 'yellow'));
         $response->appendContent(
             'This command created a web project, '
             . 'for more information setting up your VHOST, please see docs/README');
 
+        if (!Zend_Tool_Project_Provider_Test::isPHPUnitAvailable()) {
+            $response->appendContent('Testing Note: ', array('separator' => false, 'color' => 'yellow'));
+            $response->appendContent('PHPUnit was not found in your include_path, therefore no testing actions will be created.');
+        }
+            
         foreach ($newProfile->getIterator() as $resource) {
             $resource->create();
         }
@@ -120,13 +125,19 @@
 
     protected function _getDefaultProfile()
     {
+        $testAction = '';
+        if (Zend_Tool_Project_Provider_Test::isPHPUnitAvailable()) {
+            $testAction = '                    	<testApplicationActionMethod forActionName="index" />';
+        }
+        
+        $version = Zend_Version::VERSION;
+
         $data = <<<EOS
 <?xml version="1.0" encoding="UTF-8"?>
-<projectProfile type="default" version="1.10">
+<projectProfile type="default" version="$version">
     <projectDirectory>
         <projectProfileFile />
         <applicationDirectory>
-            <apisDirectory enabled="false" />
             <configsDirectory>
                 <applicationConfigFile type="ini" />
             </configsDirectory>
@@ -140,6 +151,7 @@
             <layoutsDirectory enabled="false" />
             <modelsDirectory />
             <modulesDirectory enabled="false" />
+            <servicesDirectory enabled="false" />
             <viewsDirectory>
                 <viewScriptsDirectory>
                     <viewControllerScriptsDirectory forControllerName="Index">
@@ -179,19 +191,22 @@
         <temporaryDirectory enabled="false" />
         <testsDirectory>
             <testPHPUnitConfigFile />
+            <testPHPUnitBootstrapFile />
             <testApplicationDirectory>
-                <testApplicationBootstrapFile />
-            </testApplicationDirectory>
-            <testLibraryDirectory>
-                <testLibraryBootstrapFile />
-            </testLibraryDirectory>
+                <testApplicationControllerDirectory>
+                    <testApplicationControllerFile filesystemName="IndexControllerTest.php" forControllerName="Index">
+$testAction
+                    </testApplicationControllerFile>
+                </testApplicationControllerDirectory>
+      	    </testApplicationDirectory>
+            <testLibraryDirectory />
         </testsDirectory>
     </projectDirectory>
 </projectProfile>
 EOS;
         return $data;
     }
-    
+
     public static function getDefaultReadmeContents($caller = null)
     {
         $projectDirResource = $caller->getResource()->getProfile()->search('projectDirectory');
@@ -201,13 +216,13 @@
         } else {
             $path = '/path/to/public';
         }
-        
+
         return <<< EOS
 README
 ======
 
 This directory should be used to place project specfic documentation including
-but not limited to project notes, generated API/phpdoc documentation, or 
+but not limited to project notes, generated API/phpdoc documentation, or
 manual files generated or hand written.  Ideally, this directory would remain
 in your development environment only and should not be deployed with your
 application to it's final production location.
@@ -224,14 +239,14 @@
 
    # This should be omitted in the production environment
    SetEnv APPLICATION_ENV development
-    
+
    <Directory "$path">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
-    
+
 </VirtualHost>
 
 EOS;