Annotation of embedaddon/php/ext/sqlite/tests/sqlite_session_002.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: sqlite, session destroy test
                      3: --CREDITS--
                      4: Mats Lindh <mats at lindh.no>
                      5: #Testfest php.no
                      6: --INI--
                      7: session.save_handler = sqlite
                      8: --SKIPIF--
                      9: if (!extension_loaded("session"))
                     10: {
                     11:        die("skip Session module not loaded");
                     12: }
                     13: if (!extension_loaded("sqlite"))
                     14: {
                     15:        die("skip sqlite module not loaded");
                     16: }
                     17: --FILE--
                     18: <?php
                     19: /* Description: Tests that sqlite will destroy a session when used as a session handler
                     20: * Source code: ext/sqlite/sess_sqlite.c
                     21: */
                     22: ob_start();
                     23: session_save_path(__DIR__ . "/sessiondb.sdb");
                     24: 
                     25: // start a session and save a value to it before commiting the session to the database
                     26: session_start();
                     27: $_SESSION["test"] = "foo_bar";
                     28: session_write_close();
                     29: 
                     30: // remove the session value
                     31: unset($_SESSION["test"]);
                     32: var_dump(isset($_SESSION["test"]));
                     33: 
                     34: // start the session again and destroy it
                     35: session_start();
                     36: var_dump($_SESSION["test"]);
                     37: session_destroy();
                     38: session_write_close();
                     39: 
                     40: unset($_SESSION["test"]);
                     41: 
                     42: // check that the session has been destroyed
                     43: session_start();
                     44: var_dump(isset($_SESSION["test"]));
                     45: ob_end_flush();
                     46: ?>
                     47: --EXPECTF--
                     48: bool(false)
                     49: %unicode|string%(7) "foo_bar"
                     50: bool(false)
                     51: --CLEAN--
                     52: <?php
                     53:        unlink(__DIR__ . "/sessiondb.sdb")
                     54: ?>

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