Added support for bootstrapping variables in unit tests.

This commit is contained in:
Matt Butcher
2012-03-14 11:21:48 -05:00
parent e1b244f162
commit 19d02fa304
3 changed files with 29 additions and 1 deletions

View File

@@ -57,15 +57,23 @@ class TestCase extends \PHPUnit_Framework_TestCase {
//public function __construct(score $score = NULL, locale $locale = NULL, adapter $adapter = NULL) {
public static function setUpBeforeClass() {
global $bootstrap_settings;
if (!isset($bootstrap_settings)) {
$bootstrap_settings = array();
}
self::$settings = $bootstrap_settings;
//$this->setTestNamespace('Tests\Units');
if (file_exists('test/settings.ini')) {
self::$settings = parse_ini_file('test/settings.ini');
self::$settings += parse_ini_file('test/settings.ini');
}
else {
throw new Exception('Could not access test/settings.ini');
}
\HPCloud\Bootstrap::useAutoloader();
\HPCloud\Bootstrap::setConfiguration(self::$settings);

10
test/bootstrap_curl.php Normal file
View File

@@ -0,0 +1,10 @@
<?php
/**
* @file
*
* Helpers for testing using the CurlTransport.
*/
$bootstrap_settings = array(
'transport' => '\HPCloud\Transport\CURLTransport',
);

View File

@@ -0,0 +1,10 @@
<?php
/**
* @file
*
* Helpers for testing using the CurlTransport.
*/
$bootstrap_settings = array(
'transport' => '\HPCloud\Transport\PHPStreamTransport',
);