]>
src.bluestatic.org Git - isso.git/blob - UnitTest/RegisterTest.php
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 $new = BSLoader
::NewRegister();
66 $new->register('test', 1);
67 $this->assertIsA($new->getAll(), 'array');
68 $this->assertEqual(sizeof($new->getAll()), 1);
71 public function testOverWriteRegister()
73 $this->fixture
->register('valueToOverWrite', 1);
74 $this->fixture
->register('valueToOverWrite', 2);
76 $this->assertEqual(1, $this->fixture
->get('valueToOverWrite'));
79 public function testGet()
81 $this->fixture
->register('testGet', 123);
82 $this->assertEqual(123, $this->fixture
->get('testGet'));
85 public function testUnregister()
87 $this->fixture
->register('testUnregister', 1);
88 $this->fixture
->unregister('testUnregister');
89 $this->fixture
->register('testUnregister', 2);
90 $this->assertNoErrors();
91 $this->assertEqual(2, $this->fixture
->get('testUnregister'));
94 public function testGetNoExist()
96 $this->fixture
->get('doesNotExist');
100 public function testUnregisterNoExist()
102 $this->fixture
->unregister('keyThatWontExist');
103 $this->assertError();