public function testDeleteMessage() { $uniq = mt_rand(); $message1 = $this->getTestMessage($uniq); // Store a second message for a good time, and make sure we delete the // right one. $message2 = $this->getTestMessage($uniq); $this->db->storeMessage($message1); $this->db->storeMessage($message2); // Confirm work without using the API. $pdo = $this->db->getDatabase(); $result = $pdo->query("\n\t\t\tselect * from pending\n\t\t\twhere gateway='test'\n\t\t\t\tand order_id = '{$message1['order_id']}'"); $rows = $result->fetchAll(PDO::FETCH_ASSOC); $this->assertEquals(2, count($rows), 'Both records were stored.'); $this->assertNotNull($rows[0]['id'], 'Record includes a primary row id'); $this->assertNotEquals($rows[0]['id'], $rows[1]['id'], 'Records have unique primary ids'); $this->db->deleteMessage($message1); // Confirm work without using the API. $pdo = $this->db->getDatabase(); $result = $pdo->query("\n\t\t\tselect * from pending\n\t\t\twhere gateway = 'test'\n\t\t\t\tand order_id = '{$message1['order_id']}'"); $rows = $result->fetchAll(PDO::FETCH_ASSOC); $this->assertEquals(0, count($rows), 'All rows deleted.'); }
public function testDifferentDatabases() { $pendingPdo = $this->pendingDb->getDatabase(); $initPdo = $this->paymentsInitialDb->getDatabase(); $this->assertNotEquals(spl_object_hash($pendingPdo), spl_object_hash($initPdo), 'Pending and paymentsInit databases share the same PDO'); }