function setUp() { parent::setUp(); // Install the db table // =========================================== $this->cls = new FOX_dataStore_paged_L4_tester_addMethods(); try { $install_ok = $this->cls->install(); } catch (FOX_exception $child) { $this->fail($child->dumpString(1)); } $this->assertEquals(true, $install_ok); // Clear table to guard against previous failed test // =========================================== try { $truncate_ok = $this->cls->truncate(); } catch (FOX_exception $child) { $this->fail($child->dumpString(1)); } $this->assertEquals(true, $truncate_ok); // Flush cache to guard against previous failed test // =========================================== try { $flush_ok = $this->cls->flushCache(); } catch (FOX_exception $child) { $this->fail($child->dumpString(1)); } $this->assertEquals(true, $flush_ok); }
function setUp() { parent::setUp(); $test_db = new FOX_db(); $this->base_prefix = $test_db->base_prefix; $this->builder = new FOX_queryBuilder($test_db); }
function setUp() { parent::setUp(); $test_db = new FOX_db(); $this->builder = new FOX_queryBuilder($test_db); $this->struct = array("table" => "fox_test_bw", "engine" => "InnoDB", "columns" => array("C1" => array("php" => "string", "sql" => "varchar", "format" => "%s", "width" => 250, "flags" => null, "auto_inc" => false, "default" => null, "index" => false), "C2" => array("php" => "string", "sql" => "varchar", "format" => "%s", "width" => 250, "flags" => null, "auto_inc" => false, "default" => null, "index" => false), "C3" => array("php" => "string", "sql" => "varchar", "format" => "%s", "width" => 250, "flags" => null, "auto_inc" => false, "default" => null, "index" => false), "C4" => array("php" => "string", "sql" => "varchar", "format" => "%s", "width" => 250, "flags" => null, "auto_inc" => false, "default" => null, "index" => false), "C5" => array("php" => "string", "sql" => "varchar", "format" => "%s", "width" => 250, "flags" => null, "auto_inc" => false, "default" => null, "index" => false))); }
function setUp() { parent::setUp(); $this->cls = new FOX_mCache_driver_apc(array('process_id' => 2650)); if (!$this->cls->isActive()) { $this->markTestSkipped('APC is not active on this server'); } }
function setUp() { parent::setUp(); $this->cls = new FOX_moduleManager_test_stub(); $result = $this->cls->install($error); $this->assertEquals(true, $result, FOX_debug::formatError_print($error)); unset($error); }
function setUp() { parent::setUp(); // Install the album object db table, required by the album manager class $album_object = new FOX_album(); $album_object->install(); $media_object = new FOX_media(); $media_object->install(); // Use class dependency-injection capability to load our classes with // mock objects instead of the real singletons $args = array('dCache' => new mock_dCache(), 'mediaModules' => new mock_mediaModuleManager(), 'albumModules' => new mock_albumModuleManager()); $this->alb = new FOX_albumManager($args); $this->med = new FOX_mediaManager($args); }
function setUp() { parent::setUp(); $test_db = new FOX_db(); $this->base_prefix = $test_db->base_prefix; $this->charset = $test_db->charset; $this->collate = $test_db->collate; if (!empty($this->charset)) { $this->charset_collate = "DEFAULT CHARACTER SET {$this->charset}"; } if (!empty($this->collate)) { $this->charset_collate .= " COLLATE {$this->collate}"; } $this->builder = new FOX_queryBuilder($test_db); }
function setUp() { parent::setUp(); $this->tdb = new FOX_db(); try { $this->tdb->runAddTable(self::$struct); } catch (FOX_exception $fail) { // CASE 1: the table already exists in the db (likely from a previous failed test // run), so we need to make sure its clear. // =============================================================================== if ($fail->data['numeric'] == 2) { try { $this->tdb->runTruncateTable(self::$struct); } catch (FOX_exception $child) { $this->fail("Table already existed. Failure while clearing table. Error code: " . $child->data['numeric']); } } else { $this->fail("Failure while adding table to database. Error code: " . $fail->data['numeric']); } } }
function setUp() { parent::setUp(); $this->tdb = new FOX_db(); try { $this->tdb->runAddTable(self::$struct); } catch (FOX_exception $fail) { // CASE 1: the table already exists in the db (likely from a previous failed test // run), so we need to make sure its clear. // =============================================================================== if ($fail->data['numeric'] == 2) { try { $this->tdb->runTruncateTable(self::$struct); } catch (FOX_exception $child) { $this->fail($child->dumpString(array('depth' => 10, 'data' => true))); } } else { $this->fail($child->dumpString(10)); } } }
function setUp() { parent::setUp(); $this->cls = new FOX_version(); }
function setUp() { parent::setUp(); }
function setUp() { parent::setUp(); $this->tdb = new FOX_db(); try { $this->tdb->runAddTable(self::$struct); } catch (FOX_exception $fail) { // CASE 1: the table already exists in the db (likely from a previous failed test // run), so we need to make sure its clear. // =============================================================================== if ($fail->data['numeric'] == 2) { try { $this->tdb->runTruncateTable(self::$struct); } catch (FOX_exception $child) { $this->fail("Table already existed. Failure while clearing table. Error code: " . $child->data['numeric']); } } else { $this->fail("Failure while adding table to database. Error code: " . $fail->data['numeric']); } } // Load table with data and verify it was correctly loaded $data_insert = array(array("name" => "data_01", "test" => "red", "priv" => 1, "files" => 111, "space" => 112, "position" => 1), array("name" => "data_02", "test" => "green", "priv" => 1, "files" => 222, "space" => 223, "position" => 2), array("name" => "data_03", "test" => "blue", "priv" => 1, "files" => 333, "space" => 334, "position" => 3), array("name" => "data_04", "test" => "pink", "priv" => 1, "files" => 444, "space" => 445, "position" => 4), array("name" => "data_05", "test" => "black", "priv" => 1, "files" => 555, "space" => 556, "position" => 5), array("name" => "data_06", "test" => "red", "priv" => 2, "files" => 666, "space" => 667, "position" => 6), array("name" => "data_07", "test" => "black", "priv" => 2, "files" => 777, "space" => 778, "position" => 7), array("name" => "data_08", "test" => "black", "priv" => 2, "files" => 888, "space" => 889, "position" => 8)); $data_check = array(); foreach ($data_insert as $row) { $row_obj = new stdClass(); foreach ($row as $key => $value) { $row_obj->{$key} = $value; } $data_check[] = $row_obj; } $columns = array("mode" => "exclude", "col" => "id"); try { $this->tdb->runInsertQueryMulti(self::$struct, $data_insert, $columns); } catch (FOX_exception $child) { $this->fail($child->dumpString(1)); } $ctrl = array("format" => "array_object"); try { $result = $this->tdb->runSelectQueryCol(self::$struct, 'priv', "!=", '3', $columns, $ctrl); } catch (FOX_exception $child) { $this->fail($child->dumpString(1)); } $this->assertEquals($data_check, $result); }
function setUp() { parent::setUp(); $this->clsdebug = new FOX_debug(); $this->cls = new FOX_sanitize(); }
function setUp() { parent::setUp(); $this->tdb = new FOX_db(); try { $this->tdb->runAddTable(self::$struct_primary); } catch (FOX_exception $fail) { // CASE 1: the table already exists in the db (likely from a previous failed test // run), so we need to make sure its clear. // =============================================================================== if ($fail->data['numeric'] == 2) { try { $this->tdb->runTruncateTable(self::$struct_primary); } catch (FOX_exception $child) { $this->fail("Primary table already existed. Failure while clearing table. Error code: " . $child->data['numeric']); } } else { $this->fail("Failure while adding primary table to database. Error code: " . $fail->data['numeric']); } } try { $this->tdb->runAddTable(self::$struct_join); } catch (FOX_exception $fail) { // CASE 1: the table already exists in the db (likely from a previous failed test // run), so we need to make sure its clear. // =============================================================================== if ($fail->data['numeric'] == 2) { try { $this->tdb->runTruncateTable(self::$struct_join); } catch (FOX_exception $child) { $this->fail("Join table already existed. Failure while clearing table. Error code: " . $child->data['numeric']); } } else { $this->fail("Failure while adding join table to database. Error code: " . $fail->data['numeric']); } } // Load primary table // =========================================== $pri_01 = new stdClass(); $pri_01->name = "data_01"; $pri_01->text = "Test Text String 01"; $pri_01->priv = "1"; $pri_01->files = "222"; $pri_01->space = "3333"; $pri_02 = new stdClass(); $pri_02->name = "data_02"; $pri_02->text = "Test Text String 02"; $pri_02->priv = "1"; $pri_02->files = "222"; $pri_02->space = "4444"; $pri_03 = new stdClass(); $pri_03->name = "data_03"; $pri_03->text = "Test Text String 03"; $pri_03->priv = "1"; $pri_03->files = "555"; $pri_03->space = "6666"; $pri_04 = new stdClass(); $pri_04->name = "data_04"; $pri_04->text = "Test Text String 04"; $pri_04->priv = "3"; $pri_04->files = "555"; $pri_04->space = "6666"; $pri_05 = new stdClass(); $pri_05->name = "data_05"; $pri_05->text = "Test Text String 05"; $pri_05->priv = "4"; $pri_05->files = "666"; $pri_05->space = "7777"; $check_array = array($pri_01, $pri_02, $pri_03, $pri_04, $pri_05); $columns = array("mode" => "exclude", "col" => "id"); try { $this->tdb->runInsertQueryMulti(self::$struct_primary, $pri_01, $columns); $this->tdb->runInsertQueryMulti(self::$struct_primary, $pri_02, $columns); $this->tdb->runInsertQueryMulti(self::$struct_primary, $pri_03, $columns); $this->tdb->runInsertQueryMulti(self::$struct_primary, $pri_04, $columns); $this->tdb->runInsertQueryMulti(self::$struct_primary, $pri_05, $columns); } catch (FOX_exception $child) { $this->fail($child->dumpString(1)); } // Check primary table // =========================================== try { $ctrl = array("format" => "array_object"); $result = $this->tdb->runSelectQuery(self::$struct_primary, $args = null, $columns, $ctrl); } catch (FOX_exception $child) { $this->fail($child->dumpString(1)); } $this->assertEquals($check_array, $result); // Load join table // =========================================== $sec_01 = new stdClass(); $sec_01->tree = "1"; $sec_01->quantity = "2"; $sec_01->size = "data_01"; $sec_01->color = "red"; $sec_01->weight = "11111"; $sec_02 = new stdClass(); $sec_02->tree = "1"; $sec_02->quantity = "3"; $sec_02->size = "data_02"; $sec_02->color = "green"; $sec_02->weight = "22222"; $sec_03 = new stdClass(); $sec_03->tree = "1"; $sec_03->quantity = "2"; $sec_03->size = "data_03"; $sec_03->color = "blue"; $sec_03->weight = "33333"; $sec_04 = new stdClass(); $sec_04->tree = "2"; $sec_04->quantity = "2"; $sec_04->size = "data_01"; $sec_04->color = "red"; $sec_04->weight = "11111"; $sec_05 = new stdClass(); $sec_05->tree = "3"; $sec_05->quantity = "2"; $sec_05->size = "data_02"; $sec_05->color = "green"; $sec_05->weight = "22222"; $sec_06 = new stdClass(); $sec_06->tree = "3"; $sec_06->quantity = "2"; $sec_06->size = "data_03"; $sec_06->color = "blue"; $sec_06->weight = "33333"; $sec_07 = new stdClass(); $sec_07->tree = "5"; $sec_07->quantity = "2"; $sec_07->size = "data_04"; $sec_07->color = "blue"; $sec_07->weight = "33333"; $check_array = array($sec_01, $sec_02, $sec_03, $sec_04, $sec_05, $sec_06, $sec_07); try { $this->tdb->runInsertQueryMulti(self::$struct_join, $sec_01, $columns); $this->tdb->runInsertQueryMulti(self::$struct_join, $sec_02, $columns); $this->tdb->runInsertQueryMulti(self::$struct_join, $sec_03, $columns); $this->tdb->runInsertQueryMulti(self::$struct_join, $sec_04, $columns); $this->tdb->runInsertQueryMulti(self::$struct_join, $sec_05, $columns); $this->tdb->runInsertQueryMulti(self::$struct_join, $sec_06, $columns); $this->tdb->runInsertQueryMulti(self::$struct_join, $sec_07, $columns); } catch (FOX_exception $child) { $this->fail($child->dumpString(1)); } // Check join table // =========================================== try { $ctrl = array("format" => "array_object"); $result = $this->tdb->runSelectQuery(self::$struct_join, $args = null, $columns, $ctrl); } catch (FOX_exception $child) { $this->fail($child->dumpString(1)); } $this->assertEquals($check_array, $result); }
function setUp() { parent::setUp(); $this->cls = new FOX_hashTable(); }