コード例 #1
0
 function testOrdering()
 {
     $map = new SimpleSignatureMap();
     $map->add(array(1, 2), new SimpleByValue("1, 2"));
     $map->add(array(1, 3), new SimpleByValue("1, 3"));
     $map->add(array(1), new SimpleByValue("1"));
     $map->add(array(1, 4), new SimpleByValue("1, 4"));
     $map->add(array(new AnythingExpectation()), new SimpleByValue("Any"));
     $map->add(array(2), new SimpleByValue("2"));
     $map->add("", new SimpleByValue("Default"));
     $map->add(array(), new SimpleByValue("None"));
     $this->assertEqual($map->findFirstAction(array(1, 2)), new SimpleByValue("1, 2"));
     $this->assertEqual($map->findFirstAction(array(1, 3)), new SimpleByValue("1, 3"));
     $this->assertEqual($map->findFirstAction(array(1, 4)), new SimpleByValue("1, 4"));
     $this->assertEqual($map->findFirstAction(array(1)), new SimpleByValue("1"));
     $this->assertEqual($map->findFirstAction(array(2)), new SimpleByValue("Any"));
     $this->assertEqual($map->findFirstAction(array(3)), new SimpleByValue("Any"));
     $this->assertEqual($map->findFirstAction(array()), new SimpleByValue("Default"));
 }
コード例 #2
0
 public function testOrdering()
 {
     $map = new SimpleSignatureMap();
     $map->add(array(1, 2), new SimpleByValue('1, 2'));
     $map->add(array(1, 3), new SimpleByValue('1, 3'));
     $map->add(array(1), new SimpleByValue('1'));
     $map->add(array(1, 4), new SimpleByValue('1, 4'));
     $map->add(array(new AnythingExpectation()), new SimpleByValue('Any'));
     $map->add(array(2), new SimpleByValue('2'));
     $map->add('', new SimpleByValue('Default'));
     $map->add(array(), new SimpleByValue('None'));
     $this->assertEqual($map->findFirstAction(array(1, 2)), new SimpleByValue('1, 2'));
     $this->assertEqual($map->findFirstAction(array(1, 3)), new SimpleByValue('1, 3'));
     $this->assertEqual($map->findFirstAction(array(1, 4)), new SimpleByValue('1, 4'));
     $this->assertEqual($map->findFirstAction(array(1)), new SimpleByValue('1'));
     $this->assertEqual($map->findFirstAction(array(2)), new SimpleByValue('Any'));
     $this->assertEqual($map->findFirstAction(array(3)), new SimpleByValue('Any'));
     $this->assertEqual($map->findFirstAction(array()), new SimpleByValue('Default'));
 }