Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

update tests

  • Loading branch information...
commit 2f878be72699569290eaca6ac838054478775b10 1 parent f52f57f
Daniel André Eikeland authored
14 tests/core/classes/B2DB.class.php
... ... @@ -1,14 +0,0 @@
1   -<?php
2   -
3   -class B2DB
4   -{
5   - static public function getTable($tablename)
6   - {
7   - return new B2DB();
8   - }
9   -
10   - public function getByID($id)
11   - {
12   - return new \b2db\Row();
13   - }
14   -}
72 tests/core/classes/TBGBuildTest.php
... ... @@ -1,72 +0,0 @@
1   -<?php
2   -
3   -require THEBUGGENIE_PATH . 'tests/core/classes/B2DB.class.php';
4   -require THEBUGGENIE_CORE_PATH . 'classes/generics.class.php';
5   -require THEBUGGENIE_CORE_PATH . 'classes/TBGIdentifiableClass.class.php';
6   -require THEBUGGENIE_CORE_PATH . 'classes/VersionableItem.class.php';
7   -require THEBUGGENIE_CORE_PATH . 'classes/TBGBuild.class.php';
8   -
9   -class TBGBuildsTable
10   -{
11   - const B2DBNAME = 'builds';
12   - const ID = 'builds.id';
13   - const SCOPE = 'builds.scope';
14   - const NAME = 'builds.name';
15   - const VERSION_MAJOR = 'builds.version_major';
16   - const VERSION_MINOR = 'builds.version_minor';
17   - const VERSION_REVISION = 'builds.version_revision';
18   - const EDITION = 'builds.edition';
19   - const TIMESTAMP = 'builds.timestamp';
20   - const RELEASE_DATE = 'builds.release_date';
21   - const IS_DEFAULT = 'builds.is_default';
22   - const LOCKED = 'builds.locked';
23   - const PROJECT = 'builds.project';
24   - const RELEASED = 'builds.released';
25   -}
26   -
27   -class \b2db\Row
28   -{
29   - public function get($fieldname)
30   - {
31   - return $fieldname;
32   - }
33   -}
34   -
35   -/**
36   - * Test class for TBGBuild
37   - */
38   -class TBGBuildTest extends PHPUnit_Framework_TestCase
39   -{
40   -
41   - /**
42   - * @covers TBGBuild::__construct
43   - */
44   - public function testConstruct()
45   - {
46   - $build = new TBGBuild(1);
47   - $this->assertInstanceOf('TBGBuild', $build);
48   -
49   - return $build;
50   - }
51   -
52   - /**
53   - * @covers TBGBuild::getID
54   - * @depends testConstruct
55   - */
56   - public function testGetID(TBGBuild $build)
57   - {
58   - $this->assertEquals(1, $build->getID());
59   - }
60   -
61   - /**
62   - * @covers TBGBuild::getVersion
63   - * @covers TBGBuild::getName
64   - * @covers TBGBuild::getPrintableName
65   - * @depends testConstruct
66   - */
67   - public function testGetPrintableName(TBGBuild $build)
68   - {
69   - $this->assertEquals(TBGBuildsTable::NAME . ' (' . TBGBuildsTable::VERSION_MAJOR . '.' . TBGBuildsTable::VERSION_MINOR . '.' . TBGBuildsTable::VERSION_REVISION . ')', $build->getPrintableName());
70   - }
71   -
72   -}
26 tests/core/classes/TBGContextTest.php
... ... @@ -1,26 +0,0 @@
1   -<?php
2   -
3   - require THEBUGGENIE_CORE_PATH . 'classes/TBGContext.class.php';
4   -
5   - class TBGContextTest extends PHPUnit_Framework_TestCase
6   - {
7   -
8   - /**
9   - * @covers TBGContext::isInstallmode
10   - * @covers TBGContext::checkInstallMode
11   - */
12   - public function testInstallMode()
13   - {
14   - TBGContext::checkInstallMode();
15   - if (file_exists(THEBUGGENIE_PATH . 'installed'))
16   - {
17   - $this->assertFalse(TBGContext::isInstallmode());
18   - }
19   - else
20   - {
21   - $this->assertTrue(TBGContext::isInstallmode());
22   - }
23   - }
24   -
25   - }
26   -
186 tests/core/classes/TBGEventTest.php
... ... @@ -1,186 +0,0 @@
1   -<?php
2   -
3   -require THEBUGGENIE_CORE_PATH . 'classes/\caspar\core\Event.class.php';
4   -
5   -class \caspar\core\Logging
6   -{
7   - public function log($message, $module = '', $level = '')
8   - {
9   -
10   - }
11   -}
12   -
13   -/**
14   - * Test class for \caspar\core\Event.
15   - * Generated by PHPUnit on 2010-10-05 at 16:55:02.
16   - */
17   -class \caspar\core\EventTest extends PHPUnit_Framework_TestCase
18   -{
19   -
20   - /**
21   - * @covers \caspar\core\Event::__construct
22   - * @covers \caspar\core\Event::createNew
23   - */
24   - public function testCreateNew()
25   - {
26   - $event = \caspar\core\Event::createNew('modulename', 'identifier', 'subject', array('param1' => 1, 'param2' => 2), array('listitem1', 'listitem2'));
27   -
28   - $this->assertInstanceOf('\caspar\core\Event', $event);
29   -
30   - return $event;
31   - }
32   -
33   - /**
34   - * @covers \caspar\core\Event::getIdentifier
35   - * @depends testCreateNew
36   - */
37   - public function testGetIdentifier(\caspar\core\Event $event)
38   - {
39   - $this->assertEquals('identifier', $event->getIdentifier());
40   - }
41   -
42   - /**
43   - * @covers \caspar\core\Event::getModule
44   - * @depends testCreateNew
45   - */
46   - public function testGetModule(\caspar\core\Event $event)
47   - {
48   - $this->assertEquals('modulename', $event->getModule());
49   - }
50   -
51   - /**
52   - * @covers \caspar\core\Event::getSubject
53   - * @depends testCreateNew
54   - */
55   - public function testGetSubject(\caspar\core\Event $event)
56   - {
57   - $this->assertEquals('subject', $event->getSubject());
58   - }
59   -
60   - /**
61   - * @covers \caspar\core\Event::getParameters
62   - * @covers \caspar\core\Event::getParameter
63   - * @depends testCreateNew
64   - */
65   - public function testParameters(\caspar\core\Event $event)
66   - {
67   - $this->assertArrayHasKey('param1', $event->getParameters());
68   - $this->assertEquals(1, $event->getParameter('param1'));
69   - $this->assertArrayHasKey('param2', $event->getParameters());
70   - $this->assertEquals(2, $event->getParameter('param2'));
71   - }
72   -
73   - /**
74   - * @covers \caspar\core\Event::getReturnList
75   - * @covers \caspar\core\Event::addToReturnList
76   - * @covers \caspar\core\Event::setReturnValue
77   - * @covers \caspar\core\Event::getReturnValue
78   - * @depends testCreateNew
79   - */
80   - public function testReturnListAndReturnValue(\caspar\core\Event $event)
81   - {
82   - $this->assertArrayHasKey(0, $event->getReturnList());
83   - $this->assertContains('listitem1', $event->getReturnList());
84   - $this->assertArrayHasKey(1, $event->getReturnList());
85   - $this->assertContains('listitem2', $event->getReturnList());
86   -
87   - $event->addToReturnList('listitem3');
88   - $this->assertContains('listitem3', $event->getReturnList());
89   -
90   - $event->setReturnValue('fubar');
91   - $this->assertEquals('fubar', $event->getReturnValue());
92   -
93   - $event->setReturnValue(null);
94   - $this->assertEquals(null, $event->getReturnValue());
95   - }
96   -
97   - /**
98   - * @covers \caspar\core\Event::setProcessed
99   - * @covers \caspar\core\Event::isProcessed
100   - * @depends testCreateNew
101   - */
102   - public function testProcessEvent(\caspar\core\Event $event)
103   - {
104   - $event->setProcessed(true);
105   - $this->assertTrue($event->isProcessed());
106   - $event->setProcessed(false);
107   - $this->assertFalse($event->isProcessed());
108   - }
109   -
110   - public function listenerCallback(\caspar\core\Event $event)
111   - {
112   - $this->wastriggered = true;
113   - return true;
114   - }
115   -
116   - public function listenerCallbackNonProcessingFirst(\caspar\core\Event $event)
117   - {
118   - $this->wasprocessed[] = 1;
119   - return true;
120   - }
121   -
122   - public function listenerCallbackNonProcessingSecond(\caspar\core\Event $event)
123   - {
124   - $this->wasprocessed[] = 2;
125   - $event->setProcessed();
126   - return true;
127   - }
128   -
129   - public function listenerCallbackProcessing(\caspar\core\Event $event)
130   - {
131   - $this->wasprocessed[] = 3;
132   - return true;
133   - }
134   -
135   - /**
136   - * @covers \caspar\core\Event::listen
137   - * @covers \caspar\core\Event::isAnyoneListening
138   - * @covers \caspar\core\Event::clearListeners
139   - * @depends testCreateNew
140   - */
141   - public function testListening(\caspar\core\Event $event)
142   - {
143   - \caspar\core\Event::listen('modulename', 'identifier', array($this, 'listenerCallback'));
144   - $this->assertTrue(\caspar\core\Event::isAnyoneListening('modulename', 'identifier'));
145   -
146   - \caspar\core\Event::clearListeners('modulename', 'identifier');
147   - $this->assertFalse(\caspar\core\Event::isAnyoneListening('modulename', 'identifier'));
148   -
149   - \caspar\core\Event::listen('modulename', 'identifier', array($this, 'listenerCallbackNonProcessingFirst'));
150   - \caspar\core\Event::listen('modulename', 'identifier', array($this, 'listenerCallbackNonProcessingSecond'));
151   - \caspar\core\Event::listen('modulename', 'identifier', array($this, 'listenerCallbackProcessing'));
152   - $this->assertTrue(\caspar\core\Event::isAnyoneListening('modulename', 'identifier'));
153   -
154   - return $event;
155   - }
156   -
157   - /**
158   - * @covers \caspar\core\Event::listen
159   - * @covers \caspar\core\Event::trigger
160   - * @covers \caspar\core\Event::triggerUntilProcessed
161   - * @depends testListening
162   - */
163   - public function testTriggeringAndProcessing(\caspar\core\Event $event)
164   - {
165   - $this->wastriggered = false;
166   - \caspar\core\Event::clearListeners('modulename', 'identifier');
167   - \caspar\core\Event::listen('modulename', 'identifier', array($this, 'listenerCallback'));
168   -
169   - $event->trigger();
170   - $this->assertAttributeEquals(true, 'wastriggered', $this);
171   -
172   - \caspar\core\Event::clearListeners('modulename', 'identifier');
173   - \caspar\core\Event::listen('modulename', 'identifier', array($this, 'listenerCallbackNonProcessingFirst'));
174   - \caspar\core\Event::listen('modulename', 'identifier', array($this, 'listenerCallbackNonProcessingSecond'));
175   - \caspar\core\Event::listen('modulename', 'identifier', array($this, 'listenerCallbackProcessing'));
176   -
177   - $this->wasprocessed = array();
178   - $event->triggerUntilProcessed();
179   -
180   - $this->assertAttributeNotEmpty('wasprocessed', $this);
181   - $this->assertAttributeContains(1, 'wasprocessed', $this);
182   - $this->assertAttributeContains(2, 'wasprocessed', $this);
183   - $this->assertAttributeNotContains(3, 'wasprocessed', $this);
184   - }
185   -
186   -}
3  tests/core_bootstrap.php
... ... @@ -1,4 +1 @@
1 1 <?php
2   -
3   - define ('THEBUGGENIE_PATH', realpath(dirname(__FILE__) . '/../') . '/');
4   -
2  tests/phpunit.xml
... ... @@ -1,6 +1,6 @@
1 1 <phpunit bootstrap="core_bootstrap.php">
2 2 <testsuites>
3   - <testsuite name="The Bug Genie core libraries">
  3 + <testsuite name="Caspar core libraries">
4 4 <directory>./core</directory>
5 5 </testsuite>
6 6 </testsuites>

0 comments on commit 2f878be

Please sign in to comment.
Something went wrong with that request. Please try again.