Ejemplo n.º 1
0
 /**
  * @description Create table and aggregate it
  */
 public function benchAggregate()
 {
     $table = Table::create();
     $table->createAndAddRow()->set('key', 'a')->set('num', 10);
     $table->createAndAddRow()->set('key', 'a')->set('num', 10);
     $table->createAndAddRow()->set('key', 'b')->set('num', 10);
     $table->partition(function ($row) {
         return $row['num'];
     })->fork(function ($table, $newTable) {
         $row = $newTable->createAndAddRow();
         $row->set('num', $table->getColumn('num')->sum());
     });
 }
Ejemplo n.º 2
0
 /**
  * Its should be able to have a description.
  */
 public function testDescription()
 {
     $table = Table::create()->setDescription('Hai')->setDescription('Hai');
     $this->assertEquals('Hai', $table->getDescription());
 }
Ejemplo n.º 3
0
 /**
  * Reurn a new table with the given groups.
  *
  * @param string[] $groups
  *
  * @return Table
  */
 public function createTable(array $groups = array())
 {
     $table = new Table(array());
     $table->setGroups($groups);
     return $table;
 }