function tearDown()
 {
     Limb::popToolkit();
     $this->response->tally();
     $this->user->tally();
     $this->toolkit->tally();
 }
  function tearDown()
  {
    $this->toolkit->tally();
    $this->tree->tally();

    Limb :: popToolkit();
  }
 function tearDown()
 {
     $this->request->tally();
     $this->response->tally();
     $this->toolkit->tally();
     Limb::popToolkit();
 }
  function tearDown()
  {
    $this->tree->tally();

    $this->datasource->reset();

    Limb :: popToolkit();
  }
  function tearDown()
  {
    $this->toolkit->tally();
    $this->db_table->tally();
    $this->finder->tally();

    Limb :: popToolkit();
  }
  function tearDown()
  {
    $this->db->sqlDelete('sys_session');

    $this->user->tally();

    Limb :: popToolkit();
  }
  function tearDown()
  {
    Limb :: popToolkit();

    $this->request->tally();
    $this->datasource->tally();
    $this->toolkit->tally();
    $this->site_object->tally();
  }
  function tearDown()
  {
    $this->parent->tally();
    $this->request->tally();
    $this->datasource->tally();
    $this->toolkit->tally();

    Limb :: popToolkit();
  }
  function tearDown()
  {
    $this->cache_manager->tally();
    $this->cache_manager2->tally();
    $this->uri->tally();
    $this->datasource->tally();

    Limb :: popToolkit();
  }
 function tearDown()
 {
     $this->toolkit->tally();
     $this->response->tally();
     $this->request->tally();
     $this->datasource->tally();
     $this->ini->tally();
     $this->cache->tally();
     Limb::popToolkit();
 }
  function tearDown()
  {
    $this->request->tally();
    $this->response->tally();
    $this->session->tally();
    $this->toolkit->tally();
    $this->filter_chain->tally();

    Limb :: popToolkit();
  }
  function tearDown()
  {
    Limb :: popToolkit();

    $this->request->tally();
    $this->datasource->tally();
    $this->toolkit->tally();
    $this->validator->tally();
    $this->dataspace->tally();
  }
  function tearDown()
  {
    $this->authorizer->tally();
    $this->finder->tally();
    $this->cache->tally();

    $this->datasource->reset();

    Limb :: popToolkit();
  }
  function tearDown()
  {
    $this->request->tally();
    $this->response->tally();
    $this->filter_chain->tally();
    $this->datasource->tally();
    $this->locale->tally();
    $this->user->tally();

    Limb :: popToolkit();
  }
 function tearDown()
 {
     Limb::popToolkit();
     $this->request->tally();
     $this->datasource->tally();
     $this->toolkit->tally();
     $this->site_object->tally();
     $this->controller->tally();
     $this->access_policy->tally();
     $this->command->tally();
 }
  function testCanAcceptChildrenTrue()
  {
    $this->db->sqlInsert('sys_behaviour', array('id' => $behaviour_id = 100,
                                                 'name' => 'test_behaviour'));
    $this->db->sqlInsert('sys_behaviour', array('id' => 1000,
                                                 'name' => 'junk_behaviour'));


    $this->db->sqlInsert('sys_site_object_tree', array('id' => $node_id = 10,
                                                        'root_id' => 1,
                                                        'identifier' => 'test_object',
                                                        'object_id' => $object_id = 20));

    $this->db->sqlInsert('sys_site_object_tree', array('id' => 1000,
                                                        'root_id' => 1,
                                                        'identifier' => 'junk_object',
                                                        'object_id' => 200));

    $this->db->sqlInsert('sys_site_object', array('id' => $object_id,
                                                   'class_id' => 1000,
                                                   'behaviour_id' => $behaviour_id,
                                                   'identifier' => 'test_object'));

    $tree = new MockTreeDecorator($this);
    $tree->expectOnce('canAddNode', array($node_id));
    $tree->setReturnValue('canAddNode', true);

    $mock_behaviour = new MockSiteObjectBehaviour($this);
    $mock_behaviour->expectOnce('canBeParent');
    $mock_behaviour->setReturnValue('canBeParent', true);

    $this->toolkit->setReturnValue('getTree', $tree);
    $this->toolkit->expectOnce('createBehaviour', array('testBehaviour'));
    $this->toolkit->setReturnValue('createBehaviour', $mock_behaviour);

    Limb :: registerToolkit($this->toolkit);

    $this->assertTrue(SiteObjectBehaviour :: canAcceptChildren($node_id));

    $mock_behaviour->tally();
    $tree->tally();

    Limb :: popToolkit();
  }
  function testFindCountSqlNoGroup()
  {
    $db_mock = new MockDbModule($this);
    $toolkit = new MockLimbToolkit($this);

    $toolkit->setReturnValue('getDB', $db_mock);

    Limb :: registerToolkit($toolkit);

    $sql_params['tables'][] = ',table1';
    $sql_params['tables'][] = ',table2';

    $sql_params['conditions'][] = 'OR cond1';
    $sql_params['conditions'][] = 'AND cond2';

    $expectation = new WantedPatternExpectation(
    "~^SELECT COUNT\(sso\.id\) as count.*FROM sys_site_object as sso ,table1 ,table2.*WHERE sso\.id OR cond1 AND cond2~s");

    $db_mock->expectOnce('sqlExec', array($expectation));
    $db_mock->expectNever('countSelectedRows');
    $db_mock->expectOnce('fetchRow');
    $db_mock->setReturnValue('fetchRow', array('count' => 10));

    $this->assertEqual(10, $this->finder->findCount($sql_params));

    Limb :: popToolkit();

    $db_mock->tally();
  }
  function tearDown()
  {
    $this->_cleanUp();

    $this->toolkit->tally();
    $this->tree->tally();
    $this->site_object->tally();
    $this->behaviour->tally();
    $this->behaviour_mapper->tally();

    Limb :: popToolkit();
  }
  function tearDown()
  {
    $this->mapper->tally();
    $this->toolkit->tally();

    Limb :: popToolkit();

    $this->_cleanUp();
  }
  function tearDown()
  {
    $this->request->tally();
    $this->filter_chain->tally();
    $this->datasource->tally();
    $this->site_object->tally();
    $this->filter->tally();
    $this->behaviour->tally();
    $this->response->tally();

    Limb :: popToolkit();
  }