JBZoo\PHPUnit\SerTest::testMaybe PHP Method

testMaybe() public method

public testMaybe ( )
    public function testMaybe()
    {
        $obj = new \stdClass();
        $obj->prop1 = 'Hello';
        $obj->prop2 = 'World';
        is('This is a string', Ser::maybe('This is a string'));
        is(5.81, Ser::maybe(5.81));
        is('a:0:{}', Ser::maybe(array()));
        is('O:8:"stdClass":2:{s:5:"prop1";s:5:"Hello";s:5:"prop2";s:5:"World";}', Ser::maybe($obj));
        is('a:4:{i:0;s:4:"test";i:1;s:4:"blah";s:5:"hello";s:5:"world";s:5:"array";O:8:"stdClass":2:{s:5:"prop1";s:5:"Hello";s:5:"prop2";s:5:"World";}}', Ser::maybe(array('test', 'blah', 'hello' => 'world', 'array' => $obj)));
    }