public function testGetColumnNames()
 {
     $columnNames = $this->qr->getColumnNames();
     sort($columnNames);
     //order is not determined
     $columnNamesExpected = array('nt:folder.jcr:created', 'nt:folder.jcr:createdBy', 'nt:folder.jcr:primaryType');
     $this->assertEquals($columnNamesExpected, $columnNames);
 }
 /**
  * Render a table with the results of the given QueryResultInterface
  */
 public function formatQueryResult(QueryResultInterface $result, OutputInterface $output, $elapsed)
 {
     $table = $this->tableHelper->create();
     $table->setHeaders(array_merge(array('Path', 'Index'), $result->getColumnNames()));
     foreach ($result->getRows() as $row) {
         $values = array_merge(array($row->getPath()), $row->getValues());
         foreach ($values as &$value) {
             $value = $this->textHelper->truncate($value, 255);
         }
         $table->addRow($values);
     }
     $table->render($output);
     if (true === $this->config['show_execution_time_query']) {
         $output->writeln(sprintf('%s rows in set (%s sec)', count($result->getRows()), number_format($elapsed, $this->config['execution_time_expansion'])));
     }
 }