public function testFetch()
 {
     $source = new ArraySource('users', 'id', self::$user);
     Assert::equal($source->fetch(), ArrayHash::from(reset(self::$user)));
 }
Exemple #2
0
 protected function makeArrayHash(array $val)
 {
     $hash = $val;
     $out = [];
     foreach ($hash as $key => $value) {
         if (is_numeric($key)) {
             $subOut = [];
             foreach ($value as $subKey => $subValue) {
                 $subOut[$subKey] = $this->makePaterrnedArrayHash($subValue);
             }
             $out[$key] = count($subOut) ? ArrayHash::from($subOut) : [];
         } else {
             $value = $this->makePaterrnedArrayHash($value);
             $out[$key] = $value;
         }
     }
     return count($out) ? ArrayHash::from($out, false) : [];
 }