示例#1
0
 public function testFindScalar()
 {
     $map = ["one" => "a", "two" => "b", "three" => "c", "four" => "d", "five" => "e"];
     $map = CMapObject::fromPArray($map);
     $found = $map->findScalar("c");
     $this->assertTrue($found);
     $foundUnderKey;
     $found = $map->findScalar("d", $foundUnderKey);
     $this->assertTrue($found);
     $this->assertTrue($foundUnderKey->equals("four"));
     $found = $map->findScalar("C");
     $this->assertFalse($found);
     $found = $map->findScalar("f");
     $this->assertFalse($found);
     // Special case.
     $map = new CMapObject();
     $found = $map->findScalar("a");
     $this->assertFalse($found);
 }