Example #1
0
 public function testColumns()
 {
     $users = User::find('all');
     $cols = User::columns();
     foreach ($cols as $col) {
         $this->assertTrue(array_include($col, $users->columns()));
     }
 }
Example #2
0
 /**
  * Returns an array with all table columns
  *
  * It uses the static User::$columns.
  *
  * The columns can be used for SQL statements.
  *
  * @return array
  */
 public function getColumns()
 {
     if (self::$columns === null) {
         $props = $this->retrieveProperties();
         $cols = array();
         foreach ($props as $prop) {
             $cols[] = DataObject::decamelize($prop);
         }
         self::$columns = $cols;
     }
     return self::$columns;
 }
Example #3
0
 public function testReloadColumns()
 {
     $old_col = User::columns();
     $new_col = User::columns(true);
     $this->assertEquals($old_col, $new_col);
 }