connect() public method

public connect ( )
Example #1
0
 public function testFillTable()
 {
     $testTable = 'testTable';
     $sql = "CREATE TABLE IF NOT EXISTS`" . $testTable . "` (\n                `numberPk`\tINTEGER,\n                `number`\tINTEGER,\n                `text`\tTEXT,\n                `surname`\tTEXT,\n                `description`\tBLOB,\n                PRIMARY KEY(numberPk)\n                )";
     $db = __DIR__ . '/../../Fixtures/test.sqlite';
     $connectionParams = array('path' => $db, 'driver' => 'pdo_sqlite');
     $num = 3;
     $dLayer = new DoctrineLayer();
     $dLayer->connect($connectionParams);
     DoctrineLayer::$conn->query($sql);
     $fileDir = __DIR__ . '/../../Fixtures/';
     $testFile = $fileDir . 'file.php';
     $args = array('1' => '-c', '2' => $testFile, '3' => '-t', '4' => $testTable, '5' => '-n', '6' => $num);
     $fakeConsole = new FakeConsole($args);
     $result = $fakeConsole->run();
     $res = DoctrineLayer::$conn->query("SELECT COUNT(*) FROM " . $testTable);
     $total = $res->fetchColumn(0);
     $this->assertEquals($num, $total);
     $this->assertNull($result);
 }