예제 #1
0
 /**
  * Test library instantiation
  */
 public function testInstance()
 {
     $sink = Sink::instance();
     $sink->table('one_table');
     $library = Sink::instance();
     $tables = $library->table('second_table');
     $this->assertEquals(2, count($tables));
     $this->assertEquals('one_table', $tables[0]);
     $this->assertEquals('second_table', $tables[1]);
 }
예제 #2
0
파일: sink.php 프로젝트: vimofthevine/sink
 /**
  * Apply database patches
  */
 public function action_patches()
 {
     Sink::instance()->patch($available, $applied);
     echo '<h1>Patches:</h1>';
     echo '<h2>Available patches:</h2>';
     echo '<pre>';
     foreach ($available as $table => $patches) {
         foreach ($patches as $num => $descrip) {
             echo "{$num} [{$table}] - {$descrip}<br />";
         }
     }
     echo '</pre>';
     echo '<h2>Applied patches:</h2>';
     echo '<pre>';
     foreach ($applied as $table => $patches) {
         foreach ($patches as $num => $patch) {
             echo "{$num} [{$table}] - {$patch['descrip']}<br />";
             echo '  ' . ($patch['result'] ? 'Patch applied successfully.' : 'Error applying patch.') . '<br />';
         }
     }
     echo '</pre>';
 }
예제 #3
0
 public function before()
 {
     Sink::instance()->tables(array('ut_init', 'ut_pop'));
 }
예제 #4
0
 /**
  * Set tables
  */
 public function before()
 {
     Sink::instance()->table('users');
 }