require_once 'InputTest.php';
$suite->addTestSuite('InputTest');
- require_once 'RegisterTest.php';
- $suite->addTestSuite('RegisterTest');
+ require_once 'AppTest.php';
+ $suite->addTestSuite('AppTest');
require_once 'XmlTest.php';
$suite->addTestSuite('XmlTest');
--- /dev/null
+<?php
+
+require_once 'PHPUnit/Framework.php';
+
+
+/**
+* Application Test Suite
+*
+* @author Blue Static
+* @copyright Copyright ©2002 - [#]year[#], Blue Static
+* @version $Revision$
+* @package ISSO Tests
+*
+*/
+class AppTest extends PHPUnit_Framework_TestCase
+{
+ public function setUp()
+ {
+ require_once 'ISSO/Register.php';
+ }
+
+ public function testLoadModule()
+ {
+ $this->assertTrue(BSApp::LoadModule('Input') instanceof BSInput);
+ }
+
+ public function testLoadBadModule()
+ {
+ try
+ {
+ BSApp::LoadModule('nonExistentModule');
+ $this->fail('exception expected');
+ }
+ catch (Exception $e)
+ {}
+ }
+
+ public function testSetGetAppPath()
+ {
+ BSApp::SetAppPath(getcwd());
+ $this->assertEquals(getcwd() . DIRECTORY_SEPARATOR, BSApp::GetAppPath());
+ }
+
+ public function testSetGetAppVersion()
+ {
+ BSApp::SetAppVersion('1.0-test');
+ $this->assertEquals('1.0-test', BSApp::GetAppVersion());
+ }
+
+ public function testSetGetApplication()
+ {
+ BSApp::SetApplication('ISSO Tests');
+ $this->assertEquals('ISSO Tests', BSApp::GetApplication());
+ }
+
+ public function testSetGetWebPath()
+ {
+ $path = DIRECTORY_SEPARATOR . 'Server' . DIRECTORY_SEPARATOR . 'htdocs' . DIRECTORY_SEPARATOR . 'ISSO';
+ BSApp::SetWebPath($path);
+ $this->assertEquals($path . DIRECTORY_SEPARATOR, BSApp::GetWebPath());
+ }
+
+ public function testSetGetDebug()
+ {
+ BSApp::SetDebug(true);
+ $this->assertSame(true, BSApp::GetDebug());
+ }
+
+ public function testDebugList()
+ {
+ $this->assertEquals('<select><option>Debug Notices (0)</option></select>', BSApp::GetDebugList());
+
+ BSApp::Debug('dbg');
+ $this->assertEquals('<select><option>Debug Notices (1)</option><option>--- dbg</option></select>', BSApp::GetDebugList());
+ }
+
+ public function testRegisterValue()
+ {
+ BSApp::Registry()->someKey = 'someValue';
+
+ $registry = BSApp::Registry();
+ $this->assertEquals($registry->someKey, 'someValue');
+ }
+
+ public function testGetAll()
+ {
+ BSApp::Registry()->test = 1;
+ $this->assertType('array', BSApp::Registry()->allObjects());
+ $this->assertSame(sizeof(BSApp::Registry()->allObjects()), 2);
+ }
+
+ public function testOverWriteRegister()
+ {
+ BSApp::Registry()->valueToOverWrite = 1;
+ BSApp::Registry()->valueToOverWrite = 2;
+ $this->assertEquals(2, BSApp::Registry()->valueToOverWrite);
+ }
+
+ public function testGet()
+ {
+ BSApp::Registry()->testGet = 123;
+ $this->assertEquals(123, BSApp::Registry()->testGet);
+ }
+
+ public function testUnregister()
+ {
+ BSApp::Registry()->testUnregister = 1;
+ unset(BSApp::Registry()->testUnregister);
+ $this->assertObjectNotHasAttribute('testUnregister', BSApp::Registry());
+ }
+
+ public function testGetNoExist()
+ {
+ try
+ {
+ BSApp::Registry()->doesNotExist;
+ $this->fail('exception expected');
+ }
+ catch (Exception $e)
+ {}
+ }
+
+ public function testUnregisterNoExist()
+ {
+ try
+ {
+ unset(BSApp::Registry()->keyThatWontExist);
+ $this->fail('exception expected');
+ }
+ catch (Exception $e)
+ {}
+ }
+
+ public function testGetType()
+ {
+ $input = BSApp::LoadModule('Input');
+ BSApp::Registry()->input = $input;
+ $this->assertSame($input, BSApp::Registry()->getType('Input'));
+
+ $this->assertEquals(null, BSApp::Registry()->getType('Date'));
+ }
+
+ public function testRequiredModules()
+ {
+ try
+ {
+ BSApp::RequiredModules(array('Input'));
+ }
+ catch (Exception $e)
+ {
+ $this->fail('unexpcted exception');
+ }
+
+ try
+ {
+ BSApp::RequiredModules(array('Input', 'Db'));
+ $this->fail('exception expected');
+ }
+ catch (Exception $e)
+ {}
+
+ try
+ {
+ BSApp::RequiredModules(array('Date'));
+ $this->fail('exception expected');
+ }
+ catch (Exception $e)
+ {}
+ }
+}
+
+?>
\ No newline at end of file
public function setUp()
{
require_once 'tests.config.php';
- require_once 'ISSO/Register.php';
+ require_once 'ISSO/App.php';
- $this->fixture = BSRegister::LoadModule('DbMySql');
+ $this->fixture = BSApp::LoadModule('DbMySql');
$this->fixture->connect(TEST_DB_MYSQL_HOST, TEST_DB_MYSQL_USER, TEST_DB_MYSQL_PASSWORD, TEST_DB_MYSQL_DATABASE);
$this->fixture->query("
CREATE TABLE test
{
try
{
- BSRegister::LoadModule('DbMySql')->connect('localhost', '--invalid user--', '--invalid password--', '--nodatabase--');
+ BSApp::LoadModule('DbMySql')->connect('localhost', '--invalid user--', '--invalid password--', '--nodatabase--');
$this->fail('exception expected');
}
catch (BSDbException $e)
public function setUp()
{
require_once 'tests.config.php';
- require_once 'ISSO/Register.php';
+ require_once 'ISSO/App.php';
- $this->fixture = BSRegister::LoadModule('DbMySqlI');
+ $this->fixture = BSApp::LoadModule('DbMySqlI');
$this->fixture->connect(TEST_DB_MYSQL_HOST, TEST_DB_MYSQL_USER, TEST_DB_MYSQL_PASSWORD, TEST_DB_MYSQL_DATABASE);
$this->fixture->query("
CREATE TABLE test
{
try
{
- BSRegister::LoadModule('DbMySqlI')->connect('localhost', '--invalid user--', '--invalid password--', '--nodatabase--');
+ BSApp::LoadModule('DbMySqlI')->connect('localhost', '--invalid user--', '--invalid password--', '--nodatabase--');
$this->fail('exception expected');
}
catch (BSDbException $e)
public function setUp()
{
- require_once 'ISSO/Register.php';
- $this->fixture = BSRegister::LoadModule('Date');
+ require_once 'ISSO/App.php';
+ $this->fixture = BSApp::LoadModule('Date');
}
public function testGmtTimes()
{
public function setUp()
{
- require_once('ISSO/Register.php');
+ require_once('ISSO/App.php');
}
public function testSwapCssClasses()
}
}*/
- require_once 'ISSO/Register.php';
- $this->fixture = BSRegister::LoadModule('Input');
+ require_once 'ISSO/App.php';
+ $this->fixture = BSApp::LoadModule('Input');
}
public function testSanitizeInputData()
+++ /dev/null
-<?php
-
-require_once 'PHPUnit/Framework.php';
-
-
-/**
-* Register Test Suite
-*
-* @author Blue Static
-* @copyright Copyright ©2002 - [#]year[#], Blue Static
-* @version $Revision$
-* @package ISSO Tests
-*
-*/
-class RegisterTest extends PHPUnit_Framework_TestCase
-{
- public function setUp()
- {
- require_once 'ISSO/Register.php';
- }
-
- public function testLoadModule()
- {
- $this->assertTrue(BSRegister::LoadModule('Input') instanceof BSInput);
- }
-
- public function testLoadBadModule()
- {
- try
- {
- BSRegister::LoadModule('nonExistentModule');
- $this->fail('exception expected');
- }
- catch (Exception $e)
- {}
- }
-
- public function testSetGetAppPath()
- {
- BSRegister::SetAppPath(getcwd());
- $this->assertEquals(getcwd() . DIRECTORY_SEPARATOR, BSRegister::GetAppPath());
- }
-
- public function testSetGetAppVersion()
- {
- BSRegister::SetAppVersion('1.0-test');
- $this->assertEquals('1.0-test', BSRegister::GetAppVersion());
- }
-
- public function testSetGetApplication()
- {
- BSRegister::SetApplication('ISSO Tests');
- $this->assertEquals('ISSO Tests', BSRegister::GetApplication());
- }
-
- public function testSetGetWebPath()
- {
- $path = DIRECTORY_SEPARATOR . 'Server' . DIRECTORY_SEPARATOR . 'htdocs' . DIRECTORY_SEPARATOR . 'ISSO';
- BSRegister::SetWebPath($path);
- $this->assertEquals($path . DIRECTORY_SEPARATOR, BSRegister::GetWebPath());
- }
-
- public function testSetGetDebug()
- {
- BSRegister::SetDebug(true);
- $this->assertSame(true, BSRegister::GetDebug());
- }
-
- public function testDebugList()
- {
- $this->assertEquals('<select><option>Debug Notices (0)</option></select>', BSRegister::GetDebugList());
-
- BSRegister::Debug('dbg');
- $this->assertEquals('<select><option>Debug Notices (1)</option><option>--- dbg</option></select>', BSRegister::GetDebugList());
- }
-
- public function testRegisterValue()
- {
- BSRegister::Registry()->someKey = 'someValue';
-
- $registry = BSRegister::Registry();
- $this->assertEquals($registry->someKey, 'someValue');
- }
-
- public function testGetAll()
- {
- BSRegister::Registry()->test = 1;
- $this->assertType('array', BSRegister::Registry()->allObjects());
- $this->assertSame(sizeof(BSRegister::Registry()->allObjects()), 2);
- }
-
- public function testOverWriteRegister()
- {
- BSRegister::Registry()->valueToOverWrite = 1;
- BSRegister::Registry()->valueToOverWrite = 2;
- $this->assertEquals(2, BSRegister::Registry()->valueToOverWrite);
- }
-
- public function testGet()
- {
- BSRegister::Registry()->testGet = 123;
- $this->assertEquals(123, BSRegister::Registry()->testGet);
- }
-
- public function testUnregister()
- {
- BSRegister::Registry()->testUnregister = 1;
- unset(BSRegister::Registry()->testUnregister);
- $this->assertObjectNotHasAttribute('testUnregister', BSRegister::Registry());
- }
-
- public function testGetNoExist()
- {
- try
- {
- BSRegister::Registry()->doesNotExist;
- $this->fail('exception expected');
- }
- catch (Exception $e)
- {}
- }
-
- public function testUnregisterNoExist()
- {
- try
- {
- unset(BSRegister::Registry()->keyThatWontExist);
- $this->fail('exception expected');
- }
- catch (Exception $e)
- {}
- }
-
- public function testGetType()
- {
- $input = BSRegister::LoadModule('Input');
- BSRegister::Registry()->input = $input;
- $this->assertSame($input, BSRegister::Registry()->getType('Input'));
-
- $this->assertEquals(null, BSRegister::Registry()->getType('Date'));
- }
-
- public function testRequiredModules()
- {
- try
- {
- BSRegister::RequiredModules(array('Input'));
- }
- catch (Exception $e)
- {
- $this->fail('unexpcted exception');
- }
-
- try
- {
- BSRegister::RequiredModules(array('Input', 'Db'));
- $this->fail('exception expected');
- }
- catch (Exception $e)
- {}
-
- try
- {
- BSRegister::RequiredModules(array('Date'));
- $this->fail('exception expected');
- }
- catch (Exception $e)
- {}
- }
-}
-
-?>
\ No newline at end of file