public function testHasData()
 {
     $c = new Result(['a' => 'b', 'c' => 'd']);
     $this->assertEquals('b', $c['a']);
     $this->assertEquals('d', $c['c']);
     $this->assertEquals('d', $c->get('c'));
     $this->assertTrue($c->hasKey('c'));
     $this->assertFalse($c->hasKey('f'));
     $this->assertEquals('b', $c->search('a'));
     $this->assertContains('Model Data', (string) $c);
 }
 /**
  * Check to see if the path of the output key is satisfied by the value.
  *
  * @param Result       $result Result model
  * @param string       $key    Key to check
  * @param array|string $checks Compare the key to the value
  * @param bool         $all    Set to true to ensure all value match or
  *                             false to only match one
  *
  * @return bool
  */
 private function checkPath(Result $result, $key = null, $checks = [], $all = true)
 {
     // If no key is set, then just assume true because the request succeeded
     if (!$key) {
         return true;
     }
     // If the key doesn't exist, then assume false
     if (!($values = $result->search($key))) {
         return false;
     }
     // Count the value matches
     $total = $matches = 0;
     foreach ((array) $values as $value) {
         $total++;
         foreach ((array) $checks as $check) {
             if ($value == $check) {
                 $matches++;
                 break;
             }
         }
     }
     // When matching all values, ensure that the match count equals total
     if ($all && $total !== $matches) {
         return false;
     }
     // Otherwise, return true only if at least one value matched
     return $matches > 0;
 }