Example #1
0
 /**
  * @param YoPdo $yo_pdo
  * @param callable $run_update
  */
 private function assertUpdated(YoPdo $yo_pdo, $run_update)
 {
     list($rows, $expected) = $this->sample_table_creator->getSampleRowsForUpsert();
     $table_name = $this->sample_table_creator->createPopulatedTable($yo_pdo, $rows);
     $expected[2] = $run_update($table_name, 'id = 2');
     $this->result_asserter->assertResults($yo_pdo, $table_name, $expected);
 }
Example #2
0
 /**
  * @covers ::begin
  * @covers ::rollbackAll
  * @dataProvider dbProvider
  * @param YoPdo $yo_pdo
  */
 public function testRollbackAllEndsAllNames(YoPdo $yo_pdo)
 {
     $rows = $this->sample_table_creator->getSampleRows();
     $table_name = $this->sample_table_creator->createTable($yo_pdo);
     $yo_pdo->transaction()->begin('outer');
     $yo_pdo->transaction()->begin('inner');
     $yo_pdo->insert($table_name, $rows[1]);
     $yo_pdo->transaction()->rollbackAll();
     $this->assertUnknownTransactionNameException($yo_pdo, 'inner');
     $this->assertUnknownTransactionNameException($yo_pdo, 'outer');
 }
Example #3
0
 /**
  * @covers ::bufferRecord
  * @dataProvider dbProvider
  * @param YoPdo $yo_pdo
  */
 public function testManyPreparedPlaceholdersCanBeUsed(YoPdo $yo_pdo)
 {
     $table_name = $this->sample_table_creator->createTable($yo_pdo);
     $bulk_inserter = new BulkInserter($yo_pdo, $table_name, ['a', 'b'], 2500);
     $expected_records = [];
     for ($i = 0; $i < 5000; $i++) {
         $record = ['a' => $i, 'b' => 500000 - $i];
         $bulk_inserter->bufferRecord([$record['a'], $record['b']]);
         $expected_records[$i + 1] = $record;
     }
     $this->result_asserter->assertResults($yo_pdo, $table_name, $expected_records);
 }