web/lib/Zend/Tool/Project/Context/Zf/TestPHPUnitBootstrapFile.php
changeset 808 6b6c2214f778
child 1230 68c69c656a2c
equal deleted inserted replaced
807:877f952ae2bd 808:6b6c2214f778
       
     1 <?php
       
     2 /**
       
     3  * Zend Framework
       
     4  *
       
     5  * LICENSE
       
     6  *
       
     7  * This source file is subject to the new BSD license that is bundled
       
     8  * with this package in the file LICENSE.txt.
       
     9  * It is also available through the world-wide-web at this URL:
       
    10  * http://framework.zend.com/license/new-bsd
       
    11  * If you did not receive a copy of the license and are unable to
       
    12  * obtain it through the world-wide-web, please send an email
       
    13  * to license@zend.com so we can send you a copy immediately.
       
    14  *
       
    15  * @category   Zend
       
    16  * @package    Zend_Tool
       
    17  * @subpackage Framework
       
    18  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
       
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    20  * @version    $Id: TestApplicationBootstrapFile.php 20096 2010-01-06 02:05:09Z bkarwin $
       
    21  */
       
    22 
       
    23 /**
       
    24  * @see Zend_Tool_Project_Context_Filesystem_File
       
    25  */
       
    26 require_once 'Zend/Tool/Project/Context/Filesystem/File.php';
       
    27 
       
    28 /**
       
    29  * This class is the front most class for utilizing Zend_Tool_Project
       
    30  *
       
    31  * A profile is a hierarchical set of resources that keep track of
       
    32  * items within a specific project.
       
    33  *
       
    34  * @category   Zend
       
    35  * @package    Zend_Tool
       
    36  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
       
    37  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    38  */
       
    39 class Zend_Tool_Project_Context_Zf_TestPHPUnitBootstrapFile extends Zend_Tool_Project_Context_Filesystem_File
       
    40 {
       
    41 
       
    42     /**
       
    43      * @var string
       
    44      */
       
    45     protected $_filesystemName = 'bootstrap.php';
       
    46 
       
    47     /**
       
    48      * getName()
       
    49      *
       
    50      * @return string
       
    51      */
       
    52     public function getName()
       
    53     {
       
    54         return 'TestPHPUnitBootstrapFile';
       
    55     }
       
    56     
       
    57     /**
       
    58      * getContents()
       
    59      *
       
    60      * @return string
       
    61      */
       
    62     public function getContents()
       
    63     {
       
    64         $codeGenerator = new Zend_CodeGenerator_Php_File(array(
       
    65             'body' => <<<EOS
       
    66 // Define path to application directory
       
    67 defined('APPLICATION_PATH')
       
    68     || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
       
    69 
       
    70 // Define application environment
       
    71 defined('APPLICATION_ENV')
       
    72     || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'testing'));
       
    73 
       
    74 // Ensure library/ is on include_path
       
    75 set_include_path(implode(PATH_SEPARATOR, array(
       
    76     realpath(APPLICATION_PATH . '/../library'),
       
    77     get_include_path(),
       
    78 )));
       
    79 
       
    80 require_once 'Zend/Loader/Autoloader.php';
       
    81 Zend_Loader_Autoloader::getInstance();
       
    82 
       
    83 EOS
       
    84             ));
       
    85         return $codeGenerator->generate();
       
    86     }
       
    87 
       
    88 }