Exemplo n.º 1
0
 static function test_set_and_get_appdata()
 {
     $s = new MySpaceAPI(UnitTests::$UTF8_CONSUMER_KEY, UnitTests::$UTF8_CONSUMER_SECRET);
     $test1 = rand();
     $test2 = rand();
     $data_array = array('test1' => $test1, 'test2' => $test2);
     try {
         $s->set_appdata(85628343, $data_array);
     } catch (Exception $e) {
         return FALSE;
     }
     sleep(1);
     // may take a moment for appdata to be saved
     $array = $s->get_appdata(85628343);
     $success = $array['test1'] == $test1 && $array['test2'] == $test2;
     if (!$success) {
         if ($array['test1'] != $test1) {
             echo " (set {$test1} but got {$array['test1']}) ";
         }
         if ($array['test2'] != $test2) {
             echo " (set {$test2} but got {$array['test2']}) ";
         }
     }
     return $success;
 }