dump() public static method

Given a one or more beans this method will return an array containing first part of the string representation of each item in the array.
public static dump ( OODBBean | array $data ) : array
$data OODBBean | array either a bean or an array of beans
return array
Esempio n. 1
0
 /**
  * Test dump().
  *
  * @return void
  */
 public function testDump()
 {
     $beans = R::dispense('bean', 2);
     $beans[0]->name = 'hello';
     $beans[1]->name = 'world';
     $array = R::dump($beans);
     asrt(is_array($array), TRUE);
     foreach ($array as $item) {
         asrt(is_string($item), TRUE);
     }
     $beans[1]->name = 'world, and a very long string that should be shortened';
     $array = R::dump($beans);
     asrt(is_array($array), TRUE);
     asrt(strpos($array[1], '...'), 35);
     //just to get 100% test cov, we dont need to test this
     dmp($beans);
     pass();
     //test wrong input
     asrt(is_array(R::dump(NULL)), TRUE);
     asrt(count(R::dump(NULL)), 0);
     asrt(is_array(R::dump('')), TRUE);
     asrt(count(R::dump('')), 0);
     asrt(is_array(R::dump(1)), TRUE);
     asrt(count(R::dump(1)), 0);
     asrt(is_array(R::dump(TRUE)), TRUE);
     asrt(count(R::dump(FALSE)), 0);
 }
Esempio n. 2
0
File: rb.php Progetto: WTer/NJB
 function dmp($list)
 {
     print_r(\RedBeanPHP\Facade::dump($list));
 }