Author: Anton Shevchuk
Inheritance: extends Bluz\Grid\Source\AbstractSource
Exemple #1
0
 /**
  * Init ArraySource
  * @return self
  */
 public function init()
 {
     // Array
     $adapter = new ArraySource();
     $adapter->setSource([['id' => 1, 'name' => 'Foo', 'email' => '*****@*****.**', 'status' => 'active'], ['id' => 2, 'name' => 'Bar', 'email' => '*****@*****.**', 'status' => 'active'], ['id' => 3, 'name' => 'Foo 2', 'email' => '*****@*****.**', 'status' => 'disable'], ['id' => 4, 'name' => 'Foo 3', 'email' => '*****@*****.**', 'status' => 'disable'], ['id' => 5, 'name' => 'Foo 4', 'email' => '*****@*****.**', 'status' => 'disable'], ['id' => 6, 'name' => 'Foo 5', 'email' => '*****@*****.**', 'status' => 'disable'], ['id' => 7, 'name' => 'Foo 6', 'email' => '*****@*****.**', 'status' => 'disable'], ['id' => 8, 'name' => 'Foo 7', 'email' => '*****@*****.**', 'status' => 'disable'], ['id' => 9, 'name' => 'Foo 8', 'email' => '*****@*****.**', 'status' => 'disable'], ['id' => 10, 'name' => 'Foo 9', 'email' => '*****@*****.**', 'status' => 'disable']]);
     $this->setAdapter($adapter);
     $this->setDefaultLimit(4);
     $this->setAllowOrders(['name', 'email', 'id']);
     $this->setAllowFilters(['name', 'email', 'status', 'id']);
     return $this;
 }
Exemple #2
0
 /**
  * Array Source Exception
  * @expectedException \Bluz\Grid\GridException
  */
 public function testArraySourceThrowsGridException()
 {
     $adapter = new ArraySource();
     $adapter->setSource('wrong source type');
 }