c82878e56642de5369e63108b1b2a8b136dbeb79
4 require_once('./../Loader.php');
10 * @copyright Copyright ©2002 - [#]year[#], Blue Static
15 class RegisterTest
extends UnitTestCase
19 public function setUp()
21 $this->fixture
= BSLoader
::NewRegister();
24 public function testSetGetAppPath()
26 $this->fixture
->setAppPath(getcwd());
27 $this->assertEqual(getcwd() . DIRECTORY_SEPARATOR
, $this->fixture
->getAppPath());
30 public function testSetGetAppVersion()
32 $this->fixture
->setAppVersion('1.0-test');
33 $this->assertEqual('1.0-test', $this->fixture
->getAppVersion());
36 public function testSetGetApplication()
38 $this->fixture
->setApplication('ISSO Tests');
39 $this->assertEqual('ISSO Tests', $this->fixture
->getApplication());
42 public function testSetGetWebPath()
44 $path = DIRECTORY_SEPARATOR
. 'Server' . DIRECTORY_SEPARATOR
. 'htdocs' . DIRECTORY_SEPARATOR
. 'ISSO';
45 $this->fixture
->setWebPath($path);
46 $this->assertEqual($path . DIRECTORY_SEPARATOR
, $this->fixture
->getWebPath());
49 public function testSetGetDebug()
51 $this->fixture
->setDebug(true
);
52 $this->assertIdentical(true
, $this->fixture
->getDebug());
55 public function testRegisterValue()
57 $this->fixture
->register('someKey', 'someValue');
59 $registry = $this->fixture
->getAll();
60 $this->assertEqual($registry['someKey'], 'someValue');
63 public function testGetAll()
65 $this->assertIsA($this->fixture
->getAll(), 'array');
66 $this->assertEqual(sizeof($this->fixture
->getAll()), 1);
69 public function testOverWriteRegister()
71 $this->fixture
->register('valueToOverWrite', 1);
72 $this->fixture
->register('valueToOverWrite', 2);
74 $this->assertEqual(1, $this->fixture
->get('valueToOverWrite'));
77 public function testGet()
79 $this->fixture
->register('testGet', 123);
80 $this->assertEqual(123, $this->fixture
->get('testGet'));
83 public function testUnregister()
85 $this->fixture
->register('testUnregister', 1);
86 $this->fixture
->unregister('testUnregister');
87 $this->fixture
->register('testUnregister', 2);
88 $this->assertNoErrors();
89 $this->assertEqual(2, $this->fixture
->get('testUnregister'));
92 public function testGetNoExist()
94 $this->fixture
->get('doesNotExist');
98 public function testUnregisterNoExist()
100 $this->fixture
->unregister('keyThatWontExist');
101 $this->assertError();