summaryrefslogtreecommitdiff
path: root/ext/session/tests/session_abort_basic.phpt
diff options
context:
space:
mode:
authorYasuo Ohgaki <yohgaki@php.net>2013-08-10 16:57:56 +0900
committerYasuo Ohgaki <yohgaki@php.net>2013-08-10 16:57:56 +0900
commit6941ce35839f255234c727634a2309b893e4f049 (patch)
tree47f075af7d79087c50afdaa05427ab511d709d55 /ext/session/tests/session_abort_basic.phpt
parent54a42f0d0cf85fe0c032009b1f601427ae1c8566 (diff)
downloadphp-git-6941ce35839f255234c727634a2309b893e4f049.tar.gz
Implemented Request #20421 (session_abort() and session_reset() function
Diffstat (limited to 'ext/session/tests/session_abort_basic.phpt')
-rw-r--r--ext/session/tests/session_abort_basic.phpt51
1 files changed, 51 insertions, 0 deletions
diff --git a/ext/session/tests/session_abort_basic.phpt b/ext/session/tests/session_abort_basic.phpt
new file mode 100644
index 0000000000..4a6702f0dc
--- /dev/null
+++ b/ext/session/tests/session_abort_basic.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test session_abort() function : basic functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.save_path=
+session.name=PHPSESSID
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : void session_abort(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_abort();
+
+session_id($session_id);
+session_start();
+var_dump($_SESSION); // Should only have 'foo'
+
+echo "Done".PHP_EOL;
+
+?>
+--EXPECTF--
+*** Testing session_abort() : basic functionality ***
+array(2) {
+ ["foo"]=>
+ int(123)
+ ["bar"]=>
+ int(456)
+}
+array(1) {
+ ["foo"]=>
+ int(123)
+}
+Done