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 _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;
 }