Annotation of embedaddon/php/ext/sybase_ct/tests/test_fetch_object.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Sybase-CT sybase_fetch_object
        !             3: --SKIPIF--
        !             4: <?php 
        !             5:   require('skipif.inc');
        !             6: ?>
        !             7: --FILE--
        !             8: <?php
        !             9: /* This file is part of PHP test framework for ext/sybase_ct
        !            10:  *
        !            11:  * $Id: test_fetch_object.phpt 236100 2007-05-22 11:33:36Z thekid $
        !            12:  */
        !            13: 
        !            14:   require('test.inc');
        !            15:   
        !            16:   // {{{ class article
        !            17:   class article { }
        !            18:   // }}}
        !            19:   
        !            20:   // {{{ resource fetch_object(resource db, [mixed arg= NULL])
        !            21:   //     Fetches a resultset and returns it as an object
        !            22:   function fetch_object($db, $arg= NULL) {
        !            23:     return sybase_fetch_object(sybase_query('select
        !            24:       1 as "id",
        !            25:       "Hello" as "caption",
        !            26:       "timm" as "author",
        !            27:       getdate() as "lastchange"
        !            28:     ', $db), $arg);
        !            29:   }
        !            30:   // }}}
        !            31: 
        !            32:   $db= sybase_connect_ex();
        !            33:   
        !            34:   // Test with stdClass
        !            35:   var_export(fetch_object($db)); echo "\n";
        !            36:   
        !            37:   // Test with userland class
        !            38:   var_export(fetch_object($db, 'article')); echo "\n";
        !            39: 
        !            40:   // Test with object
        !            41:   var_export(fetch_object($db, new article())); echo "\n";
        !            42: 
        !            43:   // Test with non-existant class
        !            44:   var_export(fetch_object($db, '***')); echo "\n";
        !            45:     
        !            46:   sybase_close($db);
        !            47: ?>
        !            48: --EXPECTF--
        !            49: stdClass::__set_state(array(
        !            50:    'id' => 1,
        !            51:    'caption' => 'Hello',
        !            52:    'author' => 'timm',
        !            53:    'lastchange' => '%s',
        !            54: ))
        !            55: article::__set_state(array(
        !            56:    'id' => 1,
        !            57:    'caption' => 'Hello',
        !            58:    'author' => 'timm',
        !            59:    'lastchange' => '%s',
        !            60: ))
        !            61: article::__set_state(array(
        !            62:    'id' => 1,
        !            63:    'caption' => 'Hello',
        !            64:    'author' => 'timm',
        !            65:    'lastchange' => '%s',
        !            66: ))
        !            67: 
        !            68: Notice: sybase_fetch_object(): Sybase:  Class *** has not been declared in %stest_fetch_object.php on line %d
        !            69: stdClass::__set_state(array(
        !            70:    'id' => 1,
        !            71:    'caption' => 'Hello',
        !            72:    'author' => 'timm',
        !            73:    'lastchange' => '%s',
        !            74: ))

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>