function setUp()
  {
    $this->db =& DbFactory :: instance();
    $this->db_table_test = DbTableFactory :: create('Test1');

    $this->_cleanUp();
  }
  function setUp()
  {
    $this->db =& DbFactory :: instance();
    $this->links_manager = new LinksManager();

    $this->_cleanUp();
  }
  function setUp()
  {
    $this->mapper = new SiteObjectBehaviourMapper();
    $this->db = DbFactory :: instance();

    $this->_cleanUp();
  }
  function setUp()
  {
    parent :: setUp();

    $this->db =& DbFactory :: instance();

    $tree = Limb :: toolkit()->getTree();

    $values['identifier'] = 'root';
    $this->node_id_root = $tree->createRootNode($values, false, true);

    $values['identifier'] = 'ru';
    $values['object_id'] = 1;
    $this->node_id_ru = $tree->createSubNode($this->node_id_root, $values);

    $values['identifier'] = 'document';
    $values['object_id'] = 10;
    $this->node_id_document = $tree->createSubNode($this->node_id_ru, $values);

    $values['identifier'] = 'doc1';
    $values['object_id'] = 20;
    $this->node_id_doc1 = $tree->createSubNode($this->node_id_ru, $values);

    $values['identifier'] = 'doc2';
    $values['object_id'] = 30;
    $this->node_id_doc2 = $tree->createSubNode($this->node_id_ru, $values);
  }
 function _cleanUp()
 {
     $db = DbFactory::instance();
     $db->sqlDelete('sys_action_access_template');
     $db->sqlDelete('sys_action_access_template_item');
     $db->sqlDelete('sys_action_access');
     $db->sqlDelete('sys_object_access');
 }
  function setUp()
  {
    $this->db = DbFactory :: instance();

    $this->driver = new MaterializedPathTreeTestVersion();

    $this->_cleanUp();
  }
  function setUp()
  {
    $this->db = DbFactory :: instance();

    $this->_cleanUp();

    $this->mapper = new OneTableObjectsMapperTestVersionMock($this);
  }
 function setUp()
 {
     $this->db =& DbFactory::instance();
     $this->cart_handler = new SpecialDbCartHandler($this);
     $this->cart_handler->__construct(10);
     $this->user = new MockUser($this);
     $this->cart_handler->setReturnValue('_getUser', $this->user);
     $this->_cleanUp();
 }
 function setUp()
 {
     $this->db = DbFactory::instance();
     $this->stats_counter = new StatsCounterTestVersion($this);
     $this->stats_counter->__construct();
     $this->stats_counter->setReturnValue('_isHomeHit', false);
     $this->stats_counter->setReturnValue('_isNewAudience', false);
     $this->_cleanUp();
 }
 function setUp()
 {
     $this->server = $_SERVER;
     $_SERVER['HTTP_HOST'] = 'test';
     $this->db = DbFactory::instance();
     $this->stats_referer = new StatsRefererSelfTestVersion($this);
     $this->stats_referer->__construct();
     $this->_cleanUp();
 }
  public function getDB()
  {
    if($this->db)
      return $this->db;

    include_once(LIMB_DIR . '/class/lib/db/DbFactory.class.php');
    $this->db = DbFactory :: instance();

    return $this->db;
  }
 function setUp()
 {
     $this->db = DbFactory::instance();
     $this->finder = new MockImageObjectsRawFinder($this);
     $this->media_manager = new MockMediaManager($this);
     $this->mapper = new ImageObjectMapperTestVersion($this);
     $this->mapper->setReturnValue('_getFinder', $this->finder);
     $this->mapper->setReturnValue('_getMediaManager', $this->media_manager);
     $this->_cleanUp();
 }
  function setUp()
  {
    $this->db = DbFactory :: instance();
    $this->toolkit = new MockLimbToolkit($this);
    $this->toolkit->setReturnValue('getDB', $this->db);

    $this->_cleanUp();

    $this->behaviour = new SiteObjectBehaviourTestVersion();
  }
Пример #14
0
function clearTestingDbTables()
{
  if(!isset($GLOBALS['testing_db_tables']))
    return;

  $db = DbFactory :: instance();

  foreach($GLOBALS['testing_db_tables'] as $table)
    $db->sqlDelete($table);

  $GLOBALS['testing_db_tables'] = array();
}
  function setUp()
  {
    parent :: setUp();

    $this->db = DbFactory :: instance();
    $this->db->sqlDelete('user');
    $this->db->sqlDelete('sys_site_object');

    $this->db->sqlInsert('sys_site_object', array('id' => 1, 'identifier' => 'vasa', 'class_id' => '1', 'current_version' => '1'));
    $this->db->sqlInsert('sys_site_object', array('id' => 2, 'identifier' => 'sasa', 'class_id' => '1', 'current_version' => '1'));
    $this->db->sqlInsert('user', array('id' => 1, 'name' => 'Vasa', 'password' => '1', 'version' => '1', 'object_id' => '1'));
    $this->db->sqlInsert('user', array('id' => 2, 'name' => 'Sasa', 'password' => '1', 'version' => '1', 'object_id' => '2'));
  }
  function setUp()
  {
    $this->user = new MockUser($this);
    $this->toolkit = new MockLimbToolkit($this);

    $this->toolkit->setReturnValue('getUser', $this->user);

    $this->db = DbFactory :: instance();
    $this->toolkit->setReturnValue('getDB', $this->db);

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

    $this->driver = new SessionDbDriver();
  }
  function setUp()
  {
    $this->db = DbFactory :: instance();

    $this->_cleanUp();

    $this->_insertSysClassRecord();
    $this->_insertSysBehaviourRecord();

    $this->_insertSysSiteObjectRecords();
    $this->_insertFakeSysSiteObjectRecords();

    $this->finder = new SiteObjectsRawFinder();
  }
  function setUp()
  {
    $this->db = DbFactory :: instance();
    $this->datasource = new SpecialSiteObjectsDatasource($this);

    $this->authorizer = new MockAuthorizer($this);
    $this->finder = new MockDataFinder($this);
    $this->datasource->setReturnValue('_getFinder', $this->finder);

    $this->cache = new MockCacheRegistry($this);

    $this->toolkit = new MockLimbToolkit($this);

    $this->toolkit->setReturnValue('getAuthorizer', $this->authorizer);
    $this->toolkit->setReturnValue('getCache', $this->cache);

    Limb :: registerToolkit($this->toolkit);
  }
 function testRegister()
 {
     $rule_match = new MockSearchEngineRegexRule($this);
     $rule_match->setReturnValue('match', true);
     $rule_match->setReturnValue('getMatchingPhrase', 'test');
     $rule_match->setReturnValue('getEngineName', 'engine_name');
     $this->stats_search_phrase->registerSearchEngineRule($rule_match);
     $date = new Date();
     $this->assertTrue($this->stats_search_phrase->register($date));
     $db = DbFactory::instance();
     $db->sqlSelect('sys_stat_search_phrase');
     $arr = $db->getArray();
     $this->assertEqual(sizeof($arr), 1);
     $record = current($arr);
     $this->assertEqual($record['phrase'], 'test');
     $this->assertEqual($record['engine'], 'engine_name');
     $this->assertEqual($record['time'], $date->getStamp());
 }
Пример #20
0
function getCounterRecord()
{
  $db = DbFactory :: instance();
  $db->sqlSelect('sys_stat_counter', '*');
  return $db->fetchRow();
}
 function setUp()
 {
     $this->db = DbFactory::instance();
     $this->db->sqlDelete('sys_metadata');
 }
 function sysParamsTest()
 {
   $this->db =& DbFactory :: instance();
   parent :: LimbTestCase();
 }
 function statsIpTest()
 {
     parent::LimbTestCase();
     $this->db = DbFactory::instance();
 }
  function setUp()
  {
    $this->toolkit = new SiteObjectManipulationTestToolkit($this);
    $this->tree = new MockTreeDecorator($this);
    $this->user = new MockUser($this);
    $this->behaviour_mapper = new MockSiteObjectBehaviourMapper($this);
    $this->site_object = new MockSiteObject($this);
    $this->user->setReturnValue('getId', 125);

    $this->toolkit->setReturnValue('getTree', $this->tree);
    $this->toolkit->setReturnValue('getUser', $this->user);
    $this->toolkit->setReturnValue('createDataMapper',
                                   $this->behaviour_mapper,
                                   array('SiteObjectBehaviourMapper'));

    $this->behaviour = new MockSiteObjectBehaviour($this);

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

    $this->db = DbFactory :: instance();

    $this->_cleanUp();
  }
 function cleanUp()
 {
     $db = DbFactory::instance();
     $db->sqlDelete('sys_object_access');
     $db->sqlDelete('sys_action_access');
 }
Пример #26
0
 public function selectDb($db_name)
 {
   DbFactory :: instance()->selectDb($db_name);
 }
  function setUp()
  {
    $this->db = DbFactory :: instance();

    $this->_cleanUp();

    $this->user = new MockUser($this);
    $this->user->setReturnValue('getId', 125);

    $this->toolkit = new VersionedOneTableObjectsTestToolkitMock($this);
    $this->toolkit->setReturnValue('getUser', $this->user);
    Limb :: registerToolkit($this->toolkit);

    $this->mapper = new VersionedOneTableObjectsMapperTestVersionMock($this);
  }
 function setUp()
 {
   $this->db =& DbFactory :: instance();
   $this->db->setLocaleId('en');
 }
Пример #29
0
***********************************************************************************/
if(isset($argv[1]))
  $project_dir = $argv[1];
else
  die('project dir required');

require_once($project_dir . '/setup.php');
require_once(LIMB_DIR . '/class/core/tree/MaterializedPathTree.class.php');

$tree = new MaterializedPathTree();
$driver = $tree->getDriver();
$tree_table = $driver->getNodeTable();

$root_nodes = $tree->getRootNodes();

$db = DbFactory :: instance();

echo 'total roots: ' . sizeof($root_ns_nodes) . "\n";

foreach($root_nodes as $root_node)
{
  $sub_branch = $tree->getSubBranch($root_node['id'], -1);

  $branch_size = sizeof($sub_branch);
  echo 'total nodes in current root: ' . $branch_size . "\n";

  $c = 0;
  foreach($sub_branch as $node)
  {
    echo ++$c . ' branch of ' . $branch_size . ': ';
 function setUp()
 {
     $this->db = DbFactory::instance();
     $this->_cleanUp();
     $this->finder = new ImageObjectsRawFinderTestVersion($this);
 }