Skip to content

Commit

Permalink
fixing up the base tests for libs
Browse files Browse the repository at this point in the history
  • Loading branch information
dogmatic69 committed Sep 29, 2012
1 parent aaec23e commit a970406
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions Core/Events/Test/Lib/InfinitasEventTestCase.php
Expand Up @@ -19,6 +19,8 @@ public function setUp() {
$this->ViewtEvent = new Event('ViewtEvent', $this->ViewObject, $this->plugin);
$this->ControllerEvent = new Event('ControllerEvent', $this->ControllerObject, $this->plugin);

EventCore::loadEventHandler($this->plugin);

$this->Event = EventCore::getInstance();

$this->_loadEventClass();
Expand Down Expand Up @@ -47,7 +49,7 @@ protected function _setPlugin() {
* @brief load and get an instance of the event class being tested
*/
protected function _loadEventClass() {
//App::uses($this->plugin . 'Events', $this->plugin . '.Lib');
App::uses($this->plugin . 'Events', $this->plugin . '.Lib');

$this->EventClass = $this->plugin . 'Events';
$this->EventClass = new $this->EventClass();
Expand All @@ -65,7 +67,12 @@ public function testInstance() {
*/
public function testPluginRollCall() {
$expected = array('pluginRollCall' => array($this->EventClass->onPluginRollCall()));
$expected['pluginRollCall'] = array_filter($expected['pluginRollCall']);
$return = current(array_filter($expected['pluginRollCall']));
$expected['pluginRollCall'] = array();
if($return) {
$expected['pluginRollCall'] = array($this->plugin => $return);
}

$result = $this->Event->trigger($this->ObjectObject, $this->plugin . '.pluginRollCall');
$this->assertEquals($expected, $result);
}
Expand All @@ -75,7 +82,12 @@ public function testPluginRollCall() {
*/
public function testRequireDatabaseConfigs() {
$expected = array('requireDatabaseConfigs' => array($this->EventClass->onRequireDatabaseConfigs($this->ModelEvent)));
$expected['requireDatabaseConfigs'] = array_filter($expected['requireDatabaseConfigs']);
$return = current(array_filter($expected['requireDatabaseConfigs']));
$expected['requireDatabaseConfigs'] = array();
if($return) {
$expected['requireDatabaseConfigs'] = array($this->plugin => $return);
}

$result = $this->Event->trigger($this->ModelObject, $this->plugin . '.requireDatabaseConfigs');
$this->assertEquals($expected, $result);
}
Expand Down

0 comments on commit a970406

Please sign in to comment.