RedUNIT\Blackhole\Debug::testDump PHP Метод

testDump() публичный Метод

Tests the bean dump function used to inspect the contents of a bean.
public testDump ( ) : void
Результат 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);
    }