web/lib/Zend/Tool/Project/Context/Zf/TestApplicationControllerFile.php
changeset 807 877f952ae2bd
parent 207 621fa6caec0c
child 1230 68c69c656a2c
--- a/web/lib/Zend/Tool/Project/Context/Zf/TestApplicationControllerFile.php	Thu Mar 21 17:31:31 2013 +0100
+++ b/web/lib/Zend/Tool/Project/Context/Zf/TestApplicationControllerFile.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: TestApplicationControllerFile.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: TestApplicationControllerFile.php 24593 2012-01-05 20:35:02Z matthew $
  */
 
 /**
@@ -33,7 +33,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_Context_Zf_TestApplicationControllerFile extends Zend_Tool_Project_Context_Filesystem_File
@@ -68,6 +68,27 @@
     }
 
     /**
+     * getPersistentAttributes()
+     *
+     * @return unknown
+     */
+    public function getPersistentAttributes()
+    {
+        $attributes = array();
+
+        if ($this->_forControllerName) {
+            $attributes['forControllerName'] = $this->getForControllerName();
+        }
+
+        return $attributes;
+    }
+    
+    public function getForControllerName()
+    {
+        return $this->_forControllerName;
+    }
+    
+    /**
      * getContents()
      *
      * @return string
@@ -78,23 +99,26 @@
         $filter = new Zend_Filter_Word_DashToCamelCase();
 
         $className = $filter->filter($this->_forControllerName) . 'ControllerTest';
-
+        
+        /* @var $controllerDirectoryResource Zend_Tool_Project_Profile_Resource */
+        $controllerDirectoryResource = $this->_resource->getParentResource();
+        if ($controllerDirectoryResource->getParentResource()->getName() == 'TestApplicationModuleDirectory') {
+            $className = $filter->filter(ucfirst($controllerDirectoryResource->getParentResource()->getForModuleName()))
+                . '_' . $className;
+        }        
+        
         $codeGenFile = new Zend_CodeGenerator_Php_File(array(
-            'requiredFiles' => array(
-                'PHPUnit/Framework/TestCase.php'
-                ),
             'classes' => array(
                 new Zend_CodeGenerator_Php_Class(array(
                     'name' => $className,
-                    'extendedClass' => 'PHPUnit_Framework_TestCase',
+                    'extendedClass' => 'Zend_Test_PHPUnit_ControllerTestCase',
                     'methods' => array(
                         new Zend_CodeGenerator_Php_Method(array(
                             'name' => 'setUp',
-                            'body' => '        /* Setup Routine */'
-                            )),
-                        new Zend_CodeGenerator_Php_Method(array(
-                            'name' => 'tearDown',
-                            'body' => '        /* Tear Down Routine */'
+                            'body' => <<<EOS
+\$this->bootstrap = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
+parent::setUp();
+EOS
                             ))
                         )
                     ))