php-src/ext/session/tests/session_reset_basic.phpt
Gabriel Caruso ded3d984c6 Use EXPECT instead of EXPECTF when possible
EXPECTF logic in run-tests.php is considerable, so let's avoid it.
2018-02-20 21:53:48 +01:00

51 lines
868 B
PHP

--TEST--
Test session_reset() function : basic functionality
--SKIPIF--
<?php include('skipif.inc'); ?>
--INI--
session.save_path=
session.name=PHPSESSID
session.save_handler=files
--FILE--
<?php
ob_start();
/*
* Prototype : void session_reset(void)
* Description : Should abort session. Session data should not be written.
* Source code : ext/session/session.c
*/
echo "*** Testing session_abort() : basic functionality ***\n";
session_start();
$session_id = session_id();
$_SESSION['foo'] = 123;
session_commit();
session_id($session_id);
session_start();
$_SESSION['bar'] = 456;
var_dump($_SESSION);
session_reset();
var_dump($_SESSION); // Should only have 'foo'
echo "Done".PHP_EOL;
?>
--EXPECT--
*** Testing session_abort() : basic functionality ***
array(2) {
["foo"]=>
int(123)
["bar"]=>
int(456)
}
array(1) {
["foo"]=>
int(123)
}
Done