Exemplo n.º 1
0
 public function testQuery_SqliteSquareBracketsIgnorePlaceholder()
 {
     $this->db->setErrorHandler(function () {
         $this->fail();
     });
     $result = $this->db->query("SELECT [value] FROM [x?[x] WHERE [id] = ?", 3);
     $this->assertEquals('SomeValue', $result[0]['value']);
 }
Exemplo n.º 2
0
 public function testAddCustomPlaceholder_setCustomsPlaceholdersSetCustomAdapter()
 {
     $db = new Database(new DSN('mysql:'));
     $myPlaceholderOne = Helper::getMockCustomPlaceholder('?x');
     $db->addCustomPlaceholder($myPlaceholderOne);
     $myAdapter = Helper::getMockCustomAdapter();
     $db->setAdapter($myAdapter);
     $myPlaceholderTwo = Helper::getMockCustomPlaceholder('?y');
     $db->addCustomPlaceholder($myPlaceholderTwo);
     $this->assertEquals($myAdapter, $db->getAdapter());
     $placeholders = $db->getPlaceholders();
     foreach ($db->getPlaceholders()->getAllPlaceholdersAsArray() as $placeholder) {
         $this->assertEquals($myAdapter, $placeholder->getQuotePerformer());
     }
     $this->assertEquals('f#_nadxy', $placeholders->getAllPlaceholdersAsString());
 }