Skip to content
Browse files

General housekeeping.

  • Loading branch information...
1 parent 9eb1602 commit 379497864be16fc8688f68dd78aaed0b0230cc1f @baphled committed Dec 4, 2008
Showing with 54 additions and 24 deletions.
  1. +12 −11 library/Initializer.php
  2. +19 −6 tests/libs/PHPUnit/ControllerTest.php
  3. +23 −7 tests/libs/TestHelper.php
View
23 library/Initializer.php
@@ -1,28 +1,29 @@
<?php
/**
- * My new Zend Framework project
+ * Initializer
+ *
+ * Extension of ZF initalizer, taken out of applications and placed here
+ * configuration depndeing on the type of environment.
+ * (test, development, production, etc.)
+ *
+ * This can be used to configure environment variables, databases,
+ * layouts, routers, helpers and more.
*
* @author Ekerete Akpan <ekeretex@gmail.com>
* @author Yomi Akindayini <yomi@boodah.net>
* @version $Id: Initializer.php 385 2008-12-01 13:44:44Z dean $
* @copyright 2008
* @package Zend_PHPUnit_Scaffolding
+ *
+ * @todo Determine whether this really belongs here or in tests/libs
+ *
*/
require_once realpath(dirname(__FILE__) .'/../library/Zend/ConfigSettings.php');
require_once 'Zend/Controller/Plugin/Abstract.php';
require_once 'Zend/Controller/Front.php';
require_once 'Zend/Controller/Request/Abstract.php';
require_once 'Zend/Controller/Action/HelperBroker.php';
-/**
- *
- * Initializes configuration depndeing on the type of environment
- * (test, development, production, etc.)
- *
- * This can be used to configure environment variables, databases,
- * layouts, routers, helpers and more
- *
- */
class Initializer extends Zend_Controller_Plugin_Abstract {
/**
* @var Zend_Config
@@ -71,7 +72,7 @@ public function __construct($root = null)
private function _initErrorReporting() {
Ibetx_SetupInit::initErrorReporting();
// set the test environment parameters
- if ('local' === Ibetx_SetupInit::$_env) {
+ if ('local' === Zend_SetupInit::$_env) {
$this->_front->throwExceptions(true);
}
}
View
25 tests/libs/PHPUnit/ControllerTest.php
@@ -1,7 +1,9 @@
<?php
/**
*
- * ControllerTest
+ * Zend_PHPUnit_ControllerTest
+ *
+ * Bootstrapper for Controller tests, integrates Initializer which determines the development environment.
*
* @author Yomi (baphled) Akindayini <yomi@boodah.net> 2008
* @version $Id$
@@ -11,28 +13,39 @@
*
*/
-class PHPUnit_ControllerTest extends Zend_Test_PHPUnit_ControllerTestCase {
+class Zend_PHPUnit_ControllerTest extends Zend_Test_PHPUnit_ControllerTestCase {
/**
- * Construct our Controller
+ * Construct our Controller.
+ *
+ * @access public
+ * @return void
*
*/
public function __construct() {
parent::__construct();
}
/**
- * Prepares the environment before running a test.
+ * Assigns our bootstrap.
+ *
+ * @access public
+ * @return void
+ *
*/
protected function setUp() {
$this->bootstrap = array ($this, 'appBootstrap' );
parent::setUp();
}
/**
- * Prepares the environment before running a test.
+ * Registers Initializer to the Controller.
+ *
+ * @access public
+ * @return void
+ *
*/
public function appBootstrap() {
$this->frontController->registerPlugin(new Initializer());
}
-}
+}
View
30 tests/libs/TestHelper.php
@@ -1,10 +1,26 @@
<?php
+/*
+ * TestHelper
+ *
+ * Used to build our include paths linked into ZendFramework.
+ * For each path added to the application we need to add its
+ * path here, so that our test cases can assess them accordingly.
+ *
+ * @author Yomi (baphled) Akindayini <yomi@boodah.net> 2008
+ * @version $Id$
+ * @package Zend_PHPUnit_Scaffolding
+ * @subpackage TestSuite_TestHelper
+ *
+ * @todo Can make this a procedure call, which can loop through ZF, picking up each of the relvant directories
+ *
+*/
+
set_include_path('.' . PATH_SEPARATOR .
- dirname(__FILE__) . PATH_SEPARATOR .
- dirname(__FILE__) . '/../fixtures' . PATH_SEPARATOR .
- dirname(__FILE__) . '/../../application/default/models/' . PATH_SEPARATOR .
- dirname(__FILE__) . '/../../library/' . PATH_SEPARATOR .
- dirname(__FILE__) . '/../../application/features/models/' . PATH_SEPARATOR .
- get_include_path());
+ dirname(__FILE__) . PATH_SEPARATOR .
+ dirname(__FILE__) . '/../fixtures' . PATH_SEPARATOR .
+ dirname(__FILE__) . '/../../application/default/models/' . PATH_SEPARATOR .
+ dirname(__FILE__) . '/../../library/' . PATH_SEPARATOR .
+ get_include_path());
+
require_once 'Zend/Loader.php';
-Zend_Loader::registerAutoload();
+Zend_Loader::registerAutoload();

0 comments on commit 3794978

Please sign in to comment.
Something went wrong with that request. Please try again.