|
From: <gem...@li...> - 2012-03-09 15:05:40
|
Revision: 544
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=544&view=rev
Author: mennodekker
Date: 2012-03-09 15:05:30 +0000 (Fri, 09 Mar 2012)
Log Message:
-----------
Fixing unit tests, new base test class is now ControllerTestAbstract for controller test and objects that depend on the application being loaded like Gems_Util
Modified Paths:
--------------
trunk/library/classes/Gems/Util.php
trunk/test/classes/Gems/UtilTest.php
trunk/test/classes/IndexControllerTest.php
Added Paths:
-----------
trunk/test/classes/ControllerTestAbstract.php
Modified: trunk/library/classes/Gems/Util.php
===================================================================
--- trunk/library/classes/Gems/Util.php 2012-03-09 08:41:53 UTC (rev 543)
+++ trunk/library/classes/Gems/Util.php 2012-03-09 15:05:30 UTC (rev 544)
@@ -122,11 +122,11 @@
*/
public function getConsentRejected()
{
- if (isset($this->project->consentRejected)) {
+ if ($this->project->offsetExists('consentRejected')) {
return $this->project->consentRejected;
}
- if (isset($this->project->concentRejected)) {
+ if ($this->project->offsetExists('concentRejected')) {
throw new Gems_Exception_Coding('project.ini setting was changed from "concentRejected" to "consentRejected", please update your project.ini');
return $this->project->concentRejected;
}
Added: trunk/test/classes/ControllerTestAbstract.php
===================================================================
--- trunk/test/classes/ControllerTestAbstract.php (rev 0)
+++ trunk/test/classes/ControllerTestAbstract.php 2012-03-09 15:05:30 UTC (rev 544)
@@ -0,0 +1,29 @@
+<?php
+class ControllerTestAbstract extends Zend_Test_PHPUnit_ControllerTestCase
+{
+ public function setUp()
+ {
+ // Zend_Application: loads the autoloader
+ require_once 'Zend/Application.php';
+
+ // Create application, bootstrap, and run
+ $application = new Zend_Application(
+ APPLICATION_ENV,
+ APPLICATION_PATH . '/configs/application.ini'
+ );
+
+ $this->bootstrap = $application;
+
+ parent::setUp();
+ }
+
+ /**
+ * Here we fix the intentional errors that are in de default setup
+ *
+ * At the moment we only set a salt in the project resource
+ */
+ protected function _fixSetup() {
+ $project = $this->bootstrap->getBootstrap()->getResource('project');
+ $project->salt = 'TESTCASE';
+ }
+}
Modified: trunk/test/classes/Gems/UtilTest.php
===================================================================
--- trunk/test/classes/Gems/UtilTest.php 2012-03-09 08:41:53 UTC (rev 543)
+++ trunk/test/classes/Gems/UtilTest.php 2012-03-09 15:05:30 UTC (rev 544)
@@ -1,5 +1,5 @@
<?php
-require_once 'IndexControllerTest.php';
+require_once 'ControllerTestAbstract.php';
/**
* Copyright (c) 2011, Erasmus MC
@@ -48,7 +48,7 @@
* @license New BSD License
* @since Class available since version 1.0
*/
-class Gems_UtilTest extends IndexControllerTest//Zend_Test_PHPUnit_ControllerTestCase
+class Gems_UtilTest extends ControllerTestAbstract
{
/**
* @var Gems_Util
@@ -148,7 +148,6 @@
$this->assertEquals($expected, $actual);
//Check for incorrect spelling used before 1.5.2
- unset($project->consentRejected);
$project->concentRejected = 'test2';
try {
$actual = $this->object->getConsentRejected();
Modified: trunk/test/classes/IndexControllerTest.php
===================================================================
--- trunk/test/classes/IndexControllerTest.php 2012-03-09 08:41:53 UTC (rev 543)
+++ trunk/test/classes/IndexControllerTest.php 2012-03-09 15:05:30 UTC (rev 544)
@@ -1,33 +1,7 @@
<?php
-
-class IndexControllerTest extends Zend_Test_PHPUnit_ControllerTestCase
+require_once 'ControllerTestAbstract.php';
+class IndexControllerTest extends ControllerTestAbstract
{
- public function setUp()
- {
- // Zend_Application: loads the autoloader
- require_once 'Zend/Application.php';
-
- // Create application, bootstrap, and run
- $application = new Zend_Application(
- APPLICATION_ENV,
- APPLICATION_PATH . '/configs/application.ini'
- );
-
- $this->bootstrap = $application;
-
- parent::setUp();
- }
-
- /**
- * Here we fix the intentional errors that are in de default setup
- *
- * At the moment we only set a salt in the project resource
- */
- protected function _fixSetup() {
- $project = $this->bootstrap->getBootstrap()->getResource('project');
- $project->salt = 'TESTCASE';
- }
-
public function testSaltRequired()
{
$this->dispatch('/');
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|