function test_controller()
 {
     $controller = $this->object->get_controller();
     if (is_a($controller, 'empty_controller')) {
         return;
     }
     $definitions = $controller->get_actions_definitions();
     $controller_class = get_class($controller);
     $empty_action = new empty_action();
     foreach ($definitions as $action => $data) {
         if (isset($data['template_path'])) {
             $template = new template($data['template_path']);
             $this->_check_template($template);
         }
         if (isset($data['action_path'])) {
             debug_mock::expect_never_write('write_error');
             $action_obj = action_factory::create($data['action_path']);
             $this->assertNotIdentical($action_obj, $empty_action, 'controller: "' . $controller_class . '" action object for action "' . $action . '"not found');
             $this->_check_action($action_obj);
         }
         if (isset($data['action_name'])) {
             $this->assertTrue($data['action_name'], 'controller: "' . $controller_class . '" action_name property for action "' . $action . '" is empty - check strings');
         }
     }
     $action = $controller->get_default_action();
     $this->assertTrue(isset($definitions[$action]), 'controller: "' . $controller_class . '" default action "' . $action . '" doesnt exist');
 }
 function test_create()
 {
     $c =& action_factory::create('action');
     $this->assertNotNull($c);
     debug_mock::expect_write_error('action not found', array('class_path' => 'no_such_action'));
     $c =& action_factory::create('no_such_action');
     $this->assertNull($c);
 }
 function test_create_no_such_action()
 {
 	debug_mock :: expect_write_error('action not found', array('class_path' => 'no_such_action'));
 	
 	$c =& action_factory :: create('no_such_action');
 	
 	$this->assertIsA($c, 'empty_action'); 
 }
 function &create($class_path)
 {
     $class_name = action_factory::get_class_name($class_path);
     if (file_exists(PROJECT_DIR . '/core/actions/' . $class_path . '.class.php')) {
         $full_path = PROJECT_DIR . '/core/actions/' . $class_path . '.class.php';
     } elseif (file_exists(LIMB_DIR . '/core/actions/' . $class_path . '.class.php')) {
         $full_path = LIMB_DIR . '/core/actions/' . $class_path . '.class.php';
     } else {
         debug::write_error('action not found', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('class_path' => $class_path));
         return null;
     }
     include_once $full_path;
     $action =& new $class_name();
     return $action;
 }
 function _check_controller($controller)
 {
     $definitions = $controller->get_actions_definitions();
     $controller_class = get_class($controller);
     foreach ($definitions as $action => $data) {
         $this->assertTrue(isset($data['permissions_required']), 'controller: "' . $controller_class . '" permissions_required property for action "' . $action . '"not set');
         $this->assertTrue(in_array($data['permissions_required'], array('r', 'w', 'rw')), 'controller: "' . $controller_class . '" permissions_required property for action "' . $action . '"not valid');
         if (isset($data['template_path'])) {
             $template = new template($data['template_path']);
             $this->_check_template($template);
         }
         if (isset($data['action_path'])) {
             $action_obj = action_factory::create($data['action_path']);
             $this->assertNotNull($action_obj, 'controller: "' . $controller_class . '" action object for action "' . $action . '"not found');
         }
         if (isset($data['action_name'])) {
             $this->assertTrue($data['action_name'], 'controller: "' . $controller_class . '" action_name property for action "' . $action . '" is empty - check strings');
         }
     }
     $action = $controller->get_default_action();
     $this->assertTrue(isset($definitions[$action]), 'controller: "' . $controller_class . '" default action "' . $action . '" doesnt exist');
 }
 function &_create_action($action_path)
 {
     $action =& action_factory::create($action_path);
     return $action;
 }