function test_addToken_Multi()
 {
     // Test adding multiple tokens
     // ======================================================
     $add_tokens = array("one", "two", "three", "four", "five");
     try {
         $add_result = $this->cls->addToken($add_tokens);
     } catch (FOX_exception $child) {
         $this->fail($child->dumpString(array('depth' => 50, 'data' => true)));
     }
     // Check function return
     // =======================================================
     $exp_array = array(1 => "one", 2 => "two", 3 => "three", 4 => "four", 5 => "five");
     $this->assertEquals($exp_array, $add_result);
     // Check db entry
     // =======================================================
     $db = new FOX_db();
     try {
         $select_result = $db->runSelectQuery(FOX_test_dictionary::_struct(), $args = null, $columns = null, $ctrl = array("format" => "array_array"));
     } catch (FOX_exception $child) {
         $this->fail($child->dumpString(array('depth' => 50, 'data' => true)));
     }
     $exp_array = array(array("id" => 5, "token" => "five"), array("id" => 4, "token" => "four"), array("id" => 1, "token" => "one"), array("id" => 3, "token" => "three"), array("id" => 2, "token" => "two"));
     $this->assertEquals($exp_array, $select_result);
     // Check class cache
     // =======================================================
     $exp_array = array($this->cls->generateHash("one") => 1, $this->cls->generateHash("two") => 2, $this->cls->generateHash("three") => 3, $this->cls->generateHash("four") => 4, $this->cls->generateHash("five") => 5);
     $this->assertEquals($exp_array, $this->cls->cache["tokens"]);
     $exp_array = array(1 => "one", 2 => "two", 3 => "three", 4 => "four", 5 => "five");
     $this->assertEquals($exp_array, $this->cls->cache["ids"]);
     // Test adding invalid tokens
     // ======================================================
     // Test adding one invalid one valid tokens
     try {
         $result_add = $this->cls->addToken(array("six", true));
         // Execution will halt on the previous line if addToken() throws an exception
         $this->fail("Method addToken() failed to throw an exception on invalid token type");
     } catch (FOX_exception $child) {
     }
     // Test adding multiple invalid tokens
     try {
         $result_add = $this->cls->addToken(array(12, 1.7));
         // Execution will halt on the previous line if addToken() throws an exception
         $this->fail("Method addToken() failed to throw an exception on invalid token type");
     } catch (FOX_exception $child) {
     }
     // Check class cache
     // =======================================================
     $exp_array = array($this->cls->generateHash("one") => 1, $this->cls->generateHash("two") => 2, $this->cls->generateHash("three") => 3, $this->cls->generateHash("four") => 4, $this->cls->generateHash("five") => 5);
     $this->assertEquals($exp_array, $this->cls->cache["tokens"]);
     $exp_array = array(1 => "one", 2 => "two", 3 => "three", 4 => "four", 5 => "five");
     $this->assertEquals($exp_array, $this->cls->cache["ids"]);
 }
 function test_addToken_Multi()
 {
     // Test adding multiple tokens
     // ======================================================
     $add_tokens = array("one", "two", "three", "four", "five");
     try {
         $add_result = $this->cls->addToken($add_tokens);
     } catch (FOX_exception $child) {
         throw new FOX_exception(array('numeric' => 3, 'text' => "addToken exception", 'data' => array("tokens" => $token), 'file' => __FILE__, 'class' => __CLASS__, 'function' => __FUNCTION__, 'line' => __LINE__, 'child' => $child));
         return false;
     }
     // Check function return
     // =======================================================
     $exp_array = array(1 => "one", 2 => "two", 3 => "three", 4 => "four", 5 => "five");
     $this->assertEquals($exp_array, $add_result);
     // Check db entry
     // =======================================================
     $db = new FOX_db();
     try {
         $select_result = $db->runSelectQuery(FOX_test_dictionary::_struct(), $args = null, $columns = null, $ctrl = array("format" => "array_array"));
     } catch (FOX_exception $child) {
         throw new FOX_exception(array('numeric' => 4, 'text' => "DB Select exception", 'data' => array("ctrl" => $ctrl), 'file' => __FILE__, 'class' => __CLASS__, 'function' => __FUNCTION__, 'line' => __LINE__, 'child' => $child));
         return false;
     }
     $exp_array = array(array("id" => 5, "token" => "five"), array("id" => 4, "token" => "four"), array("id" => 1, "token" => "one"), array("id" => 3, "token" => "three"), array("id" => 2, "token" => "two"));
     $this->assertEquals($exp_array, $select_result);
     // Check class cache
     // =======================================================
     $exp_array = array($this->cls->generateHash("one") => 1, $this->cls->generateHash("two") => 2, $this->cls->generateHash("three") => 3, $this->cls->generateHash("four") => 4, $this->cls->generateHash("five") => 5);
     $this->assertEquals($exp_array, $this->cls->cache["tokens"]);
     $exp_array = array(1 => "one", 2 => "two", 3 => "three", 4 => "four", 5 => "five");
     $this->assertEquals($exp_array, $this->cls->cache["ids"]);
     // Test adding invalid tokens
     // ======================================================
     try {
         $result_add = $this->cls->addToken(array("six", true));
         // Execution will halt on the previous line if addToken() throws an exception
         $this->fail("Method addToken() failed to throw an exception on invalid token type");
     } catch (FOX_exception $child) {
     }
     // Check class cache
     // =======================================================
     $exp_array = array($this->cls->generateHash("one") => 1, $this->cls->generateHash("two") => 2, $this->cls->generateHash("three") => 3, $this->cls->generateHash("four") => 4, $this->cls->generateHash("five") => 5);
     $this->assertEquals($exp_array, $this->cls->cache["tokens"]);
     $exp_array = array(1 => "one", 2 => "two", 3 => "three", 4 => "four", 5 => "five");
     $this->assertEquals($exp_array, $this->cls->cache["ids"]);
 }