/**
  * Test for creation of a graph and a traversal
  * Modeled after: http://www.arangodb.com/manuals/1.4/HttpTraversals.html
  *
  * Test:
  * If the underlying graph is cyclic, maxIterations should be set:
  * The underlying graph has two vertices Alice and Bob. With the directed edges:
  * Alice knows Bob _ Bob knows Alice
  */
 public function testTraversalTooManyIterations()
 {
     $this->createGraph();
     $startVertex = $this->vertexCollectionName . '/' . $this->vertex1Name;
     $edgeCollection = $this->edgeCollectionName;
     $options = array('direction' => 'any', 'uniqueness' => array('vertices' => 'none', 'edges' => 'none'), 'maxIterations' => 5);
     $traversal = new Traversal($this->connection, $startVertex, $edgeCollection, $options);
     try {
         $traversal->getResult();
     } catch (Exception $e) {
         // don't bother us, if it's already deleted.
     }
     $details = $e->getDetails();
     $expectedCutDownMessage = "too many iterations";
     $len = strlen($expectedCutDownMessage);
     $this->assertTrue($e->getCode() == 500 && substr($details['errorMessage'], 0, $len) == $expectedCutDownMessage, 'Did not return code 500 with first part of the message: "' . $expectedCutDownMessage . '", instead returned: ' . $e->getCode() . ' and "' . $details['errorMessage'] . '"');
 }