Beispiel #1
0
 /**
  * Adds a node object to graph given value and neighbors
  * @param string $value
  * @param array $neighbors
  */
 protected function populateRowItem($value, array $neighbors)
 {
     KeyPress::validateInput($neighbors);
     // add node to graph, patten: key: ascii value of character, value: node object.
     $this->nodes[ord($value)] = $neighbors;
 }
Beispiel #2
0
 /**
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage 1 is not a valid KeyPress direction.
  */
 public function testValidateInputWithInvalidKey()
 {
     $neighbors = array('1', '2', '3', '4');
     KeyPress::validateInput($neighbors);
 }