Пример #1
0
 public function testDatabaseDumpPDO()
 {
     $table = new \Cli\Table();
     $db = new \PDO('mysql:host=localhost;dbname=test', 'H675X16em4', 'XOc1pu3AcAnINA2eKEY4ruRO8i8iXI');
     $stmt = $db->prepare('SELECT * FROM `table`');
     $stmt->execute();
     $table->importFromPDO($stmt);
     $this->expectOutputString('+-------------+-------------+-------------+' . "\n" . '| Col 1       | Col 2       | Col 3       |' . "\n" . '+-------------+-------------+-------------+' . "\n" . '| Col 1 Row 1 | Col 2 Row 1 | Col 3 Row 1 |' . "\n" . '| Col 1 Row 2 | Col 2 Row 2 | Col 3 Row 2 |' . "\n" . '| Col 1 Row 3 | Col 2 Row 3 | Col 3 Row 3 |' . "\n" . '+-------------+-------------+-------------+' . "\n");
     $table->show();
 }