Move test_ext_{apc,apache} to php
Should include everything except I dropped: - anything that just tested we're throwing NotImplementedException - something about start_time() in ext_apc
Esse commit está contido em:
@@ -34,8 +34,6 @@
|
||||
#include "hphp/facebook/extensions/string_buffer/test_ext_string_buffer.h"
|
||||
#include "hphp/facebook/extensions/tao/test_ext_tao.h"
|
||||
#include "hphp/facebook/extensions/urlextraction/test_ext_urlextraction.h"
|
||||
#include "hphp/test/ext/test_ext_apache.h"
|
||||
#include "hphp/test/ext/test_ext_apc.h"
|
||||
#include "hphp/test/ext/test_ext_apd.h"
|
||||
#include "hphp/test/ext/test_ext_array.h"
|
||||
#include "hphp/test/ext/test_ext_asio.h"
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| HipHop for PHP |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2010-2013 Facebook, Inc. (http://www.facebook.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_01.txt |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "hphp/test/ext/test_ext_apache.h"
|
||||
#include "hphp/runtime/ext/ext_apache.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TestExtApache::RunTests(const std::string &which) {
|
||||
bool ret = true;
|
||||
|
||||
RUN_TEST(test_apache_note);
|
||||
RUN_TEST(test_apache_request_headers);
|
||||
RUN_TEST(test_apache_response_headers);
|
||||
RUN_TEST(test_apache_setenv);
|
||||
RUN_TEST(test_getallheaders);
|
||||
RUN_TEST(test_virtual);
|
||||
RUN_TEST(test_apache_get_config);
|
||||
RUN_TEST(test_apache_get_scoreboard);
|
||||
RUN_TEST(test_apache_get_rewrite_rules);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TestExtApache::test_apache_note() {
|
||||
f_apache_note("blarb", "foo");
|
||||
VS(f_apache_note("blarb", "smurf"), "foo");
|
||||
VS(f_apache_note("blarb"), "smurf");
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtApache::test_apache_request_headers() {
|
||||
f_apache_request_headers();
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtApache::test_apache_response_headers() {
|
||||
f_apache_response_headers();
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtApache::test_apache_setenv() {
|
||||
f_apache_setenv("", "");
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtApache::test_getallheaders() {
|
||||
f_getallheaders();
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtApache::test_virtual() {
|
||||
try {
|
||||
f_virtual("");
|
||||
} catch (const NotSupportedException& e) {
|
||||
return Count(true);
|
||||
}
|
||||
return Count(false);
|
||||
}
|
||||
|
||||
bool TestExtApache::test_apache_get_config() {
|
||||
f_apache_get_config();
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtApache::test_apache_get_scoreboard() {
|
||||
f_apache_get_scoreboard();
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtApache::test_apache_get_rewrite_rules() {
|
||||
try {
|
||||
f_apache_get_rewrite_rules();
|
||||
} catch (const NotSupportedException& e) {
|
||||
return Count(true);
|
||||
}
|
||||
return Count(false);
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| HipHop for PHP |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2010-2013 Facebook, Inc. (http://www.facebook.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_01.txt |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#ifndef incl_HPHP_TEST_EXT_APACHE_H_
|
||||
#define incl_HPHP_TEST_EXT_APACHE_H_
|
||||
|
||||
// >>>>>> Generated by idl.php. Do NOT modify. <<<<<<
|
||||
|
||||
#include "hphp/test/ext/test_cpp_ext.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class TestExtApache : public TestCppExt {
|
||||
public:
|
||||
virtual bool RunTests(const std::string &which);
|
||||
|
||||
bool test_apache_child_terminate();
|
||||
bool test_apache_get_modules();
|
||||
bool test_apache_get_version();
|
||||
bool test_apache_getenv();
|
||||
bool test_apache_lookup_uri();
|
||||
bool test_apache_note();
|
||||
bool test_apache_request_headers();
|
||||
bool test_apache_reset_timeout();
|
||||
bool test_apache_response_headers();
|
||||
bool test_apache_setenv();
|
||||
bool test_ascii2ebcdic();
|
||||
bool test_ebcdic2ascii();
|
||||
bool test_getallheaders();
|
||||
bool test_virtual();
|
||||
bool test_apache_get_config();
|
||||
bool test_apache_get_scoreboard();
|
||||
bool test_apache_get_rewrite_rules();
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // incl_HPHP_TEST_EXT_APACHE_H_
|
||||
@@ -1,332 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| HipHop for PHP |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2010-2013 Facebook, Inc. (http://www.facebook.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_01.txt |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "hphp/test/ext/test_ext_apc.h"
|
||||
#include "hphp/runtime/ext/ext_apc.h"
|
||||
#include "hphp/runtime/ext/ext_options.h"
|
||||
#include "hphp/runtime/base/shared/shared_store_base.h"
|
||||
#include "hphp/runtime/base/runtime_option.h"
|
||||
#include "hphp/runtime/base/program_functions.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace HPHP {
|
||||
extern SharedStores s_apc_store;
|
||||
}
|
||||
|
||||
bool TestExtApc::RunTests(const std::string &which) {
|
||||
bool ret = true;
|
||||
|
||||
RuntimeOption::ApcTableType = RuntimeOption::ApcConcurrentTable;
|
||||
s_apc_store.reset();
|
||||
printf("\nNon shared-memory concurrent version:\n");
|
||||
RUN_TEST(test_apc);
|
||||
RUN_TEST(test_apc_add);
|
||||
RUN_TEST(test_apc_store);
|
||||
RUN_TEST(test_apc_fetch);
|
||||
RUN_TEST(test_apc_delete);
|
||||
RUN_TEST(test_apc_compile_file);
|
||||
RUN_TEST(test_apc_cache_info);
|
||||
RUN_TEST(test_apc_clear_cache);
|
||||
RUN_TEST(test_apc_define_constants);
|
||||
RUN_TEST(test_apc_load_constants);
|
||||
RUN_TEST(test_apc_sma_info);
|
||||
RUN_TEST(test_apc_filehits);
|
||||
RUN_TEST(test_apc_delete_file);
|
||||
RUN_TEST(test_apc_inc);
|
||||
RUN_TEST(test_apc_dec);
|
||||
RUN_TEST(test_apc_cas);
|
||||
RUN_TEST(test_apc_bin_dump);
|
||||
RUN_TEST(test_apc_bin_load);
|
||||
RUN_TEST(test_apc_bin_dumpfile);
|
||||
RUN_TEST(test_apc_bin_loadfile);
|
||||
RUN_TEST(test_apc_exists);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TestExtApc::test_apc() {
|
||||
VS(f_ini_get("apc.enabled"), "1");
|
||||
VS(f_ini_get("apc.enable_cli"), "1");
|
||||
VS(f_ini_get("apc.stat"), (RuntimeOption::RepoAuthoritative)
|
||||
? "0" : "1");
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtApc::test_apc_add() {
|
||||
f_apc_add("ts", "TestString");
|
||||
f_apc_add("ta", CREATE_MAP2("a", 1, "b", 2));
|
||||
f_apc_add("ts", "NewValue");
|
||||
f_apc_add("ta", CREATE_VECTOR1("newelement"));
|
||||
VS(f_apc_fetch("ts"), "TestString");
|
||||
VS(f_apc_fetch("ta"), CREATE_MAP2("a", 1, "b", 2));
|
||||
|
||||
VS(f_apc_fetch("ts"), "TestString");
|
||||
VS(f_apc_fetch("ta"), CREATE_MAP2("a", 1, "b", 2));
|
||||
|
||||
f_apc_add("texp", "TestString", 1);
|
||||
sleep(1);
|
||||
VS(f_apc_fetch("texp"), false);
|
||||
|
||||
Variant ret = f_apc_store("foo", false);
|
||||
VS(ret, true);
|
||||
ret = f_apc_add("foo", false);
|
||||
VS(ret, false);
|
||||
Variant success;
|
||||
ret = f_apc_fetch("foo", ref(success));
|
||||
VS(ret, false);
|
||||
VS(success, true);
|
||||
ret = f_apc_fetch("bar", ref(success));
|
||||
VS(ret, false);
|
||||
VS(success, false);
|
||||
Variant map1= CREATE_MAP1("foo", false);
|
||||
ret = f_apc_fetch(CREATE_VECTOR1("foo"), ref(success));
|
||||
VS(ret, map1);
|
||||
ret = f_apc_fetch(CREATE_VECTOR1("bar"), ref(success));
|
||||
VS(ret, Array::Create());
|
||||
VS(success, false);
|
||||
ret = f_apc_fetch(CREATE_VECTOR2("foo", "bar"), ref(success));
|
||||
VS(ret, map1);
|
||||
VS(success, true);
|
||||
ret = f_apc_fetch(CREATE_VECTOR4("foo", "bar", "foo", "bar"), ref(success));
|
||||
VS(ret, map1);
|
||||
VS(success, true);
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
static const StaticString s_a("a");
|
||||
static const StaticString s_q("q");
|
||||
static const StaticString s_ts("ts");
|
||||
static const StaticString s_TestString("TestString");
|
||||
static const StaticString s_start_time("start_time");
|
||||
|
||||
bool TestExtApc::test_apc_store() {
|
||||
Array complexMap = CREATE_MAP2("a",
|
||||
CREATE_MAP2("b", 1, "c",
|
||||
CREATE_VECTOR2("d", "e")),
|
||||
"f", CREATE_VECTOR3(1,2,3));
|
||||
f_apc_store("complexMap", complexMap);
|
||||
f_apc_store("ts", "TestString");
|
||||
f_apc_store("ta", CREATE_MAP2("a", 1, "b", 2));
|
||||
f_apc_store("ts", "NewValue");
|
||||
f_apc_store("ta", CREATE_VECTOR1("newelement"));
|
||||
VS(f_apc_fetch("ts"), "NewValue");
|
||||
VS(f_apc_fetch("ta"), CREATE_VECTOR1("newelement"));
|
||||
VS(f_apc_fetch("complexMap"), complexMap);
|
||||
|
||||
VS(f_apc_fetch("ts"), "NewValue");
|
||||
VS(f_apc_fetch("ta"), CREATE_VECTOR1("newelement"));
|
||||
VS(f_apc_fetch("complexMap"), complexMap);
|
||||
|
||||
// Make sure it doesn't change the shared value.
|
||||
Array complexMapFetched = f_apc_fetch("complexMap");
|
||||
VERIFY(complexMapFetched.exists(s_a));
|
||||
complexMapFetched.set(s_q,0);
|
||||
VERIFY(complexMapFetched.exists(s_q));
|
||||
VS(f_apc_fetch("complexMap"), complexMap);
|
||||
|
||||
String tsFetched = f_apc_fetch("ts");
|
||||
VS(tsFetched, "NewValue");
|
||||
String sharedString = tsFetched;
|
||||
tsFetched.set(0, String("M"));
|
||||
VS(tsFetched, "MewValue");
|
||||
VS(sharedString, "NewValue");
|
||||
VERIFY(tsFetched.get() != sharedString.get());
|
||||
VS(f_apc_fetch("ts"), "NewValue");
|
||||
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtApc::test_apc_fetch() {
|
||||
// reproducing a memory leak (3/26/09)
|
||||
f_apc_add("apcdata", CREATE_MAP2("a", "test", "b", 1)); // MapVariant
|
||||
{
|
||||
Variant apcdata = f_apc_fetch("apcdata");
|
||||
Variant c = apcdata; // bump up ref count to make a MapVariant copy
|
||||
apcdata.set(String("b"), 3); // problem
|
||||
VS(apcdata, CREATE_MAP2("a", "test", "b", 3));
|
||||
}
|
||||
{
|
||||
Variant apcdata = f_apc_fetch("apcdata");
|
||||
apcdata += CREATE_MAP1("b", 4); // problem
|
||||
VS(apcdata, CREATE_MAP2("a", "test", "b", 1));
|
||||
}
|
||||
{
|
||||
Variant apcdata = f_apc_fetch(CREATE_VECTOR2("apcdata", "nah"));
|
||||
VS(apcdata, CREATE_MAP1("apcdata", CREATE_MAP2("a", "test", "b", 1)));
|
||||
}
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtApc::test_apc_delete() {
|
||||
f_apc_store("ts", "TestString");
|
||||
f_apc_store("ta", CREATE_MAP2("a", 1, "b", 2));
|
||||
f_apc_delete("ts");
|
||||
f_apc_delete("ta");
|
||||
VS(f_apc_fetch("ts"), false);
|
||||
VS(f_apc_fetch("ta"), false);
|
||||
|
||||
VS(f_apc_fetch("ts"), false);
|
||||
VS(f_apc_fetch("ta"), false);
|
||||
|
||||
f_apc_store("ts", "TestString");
|
||||
f_apc_store("ta", CREATE_MAP2("a", 1, "b", 2));
|
||||
VS(f_apc_delete(CREATE_VECTOR2("ts", "ta")), Array::Create());
|
||||
VS(f_apc_fetch("ts"), false);
|
||||
VS(f_apc_fetch("ta"), false);
|
||||
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtApc::test_apc_compile_file() {
|
||||
try {
|
||||
f_apc_compile_file("");
|
||||
} catch (const NotSupportedException& e) {
|
||||
return Count(true);
|
||||
}
|
||||
return Count(false);
|
||||
}
|
||||
|
||||
bool TestExtApc::test_apc_cache_info() {
|
||||
Array ci = f_apc_cache_info();
|
||||
VS(ci.rvalAt(s_start_time), start_time());
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtApc::test_apc_clear_cache() {
|
||||
f_apc_store("ts", "TestString");
|
||||
f_apc_store("ta", CREATE_MAP2("a", 1, "b", 2));
|
||||
|
||||
f_apc_clear_cache();
|
||||
VS(f_apc_fetch("ts"), false);
|
||||
VS(f_apc_fetch("ta"), false);
|
||||
|
||||
VS(f_apc_fetch("ts"), false);
|
||||
VS(f_apc_fetch("ta"), false);
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtApc::test_apc_define_constants() {
|
||||
try {
|
||||
f_apc_define_constants("", "");
|
||||
} catch (const NotSupportedException& e) {
|
||||
return Count(true);
|
||||
}
|
||||
return Count(false);
|
||||
}
|
||||
|
||||
bool TestExtApc::test_apc_load_constants() {
|
||||
try {
|
||||
f_apc_load_constants("");
|
||||
} catch (const NotSupportedException& e) {
|
||||
return Count(true);
|
||||
}
|
||||
return Count(false);
|
||||
}
|
||||
|
||||
bool TestExtApc::test_apc_sma_info() {
|
||||
VS(f_apc_sma_info(), Array::Create());
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtApc::test_apc_filehits() {
|
||||
try {
|
||||
f_apc_filehits();
|
||||
} catch (const NotSupportedException& e) {
|
||||
return Count(true);
|
||||
}
|
||||
return Count(false);
|
||||
}
|
||||
|
||||
bool TestExtApc::test_apc_delete_file() {
|
||||
try {
|
||||
f_apc_delete_file("");
|
||||
} catch (const NotSupportedException& e) {
|
||||
return Count(true);
|
||||
}
|
||||
return Count(false);
|
||||
}
|
||||
|
||||
bool TestExtApc::test_apc_inc() {
|
||||
f_apc_store("ts", 12);
|
||||
VS(f_apc_inc("ts"), 13);
|
||||
VS(f_apc_inc("ts", 5), 18);
|
||||
VS(f_apc_inc("ts", -3), 15);
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtApc::test_apc_dec() {
|
||||
f_apc_store("ts", 12);
|
||||
VS(f_apc_dec("ts"), 11);
|
||||
VS(f_apc_dec("ts", 5), 6);
|
||||
VS(f_apc_dec("ts", -3), 9);
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtApc::test_apc_cas() {
|
||||
f_apc_store("ts", 12);
|
||||
f_apc_cas("ts", 12, 15);
|
||||
VS(f_apc_fetch("ts"), 15);
|
||||
f_apc_cas("ts", 12, 18);
|
||||
VS(f_apc_fetch("ts"), 15);
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtApc::test_apc_bin_dump() {
|
||||
try {
|
||||
f_apc_bin_dump();
|
||||
} catch (const NotSupportedException& e) {
|
||||
return Count(true);
|
||||
}
|
||||
return Count(false);
|
||||
}
|
||||
|
||||
bool TestExtApc::test_apc_bin_load() {
|
||||
try {
|
||||
f_apc_bin_load("");
|
||||
} catch (const NotSupportedException& e) {
|
||||
return Count(true);
|
||||
}
|
||||
return Count(false);
|
||||
}
|
||||
|
||||
bool TestExtApc::test_apc_bin_dumpfile() {
|
||||
try {
|
||||
f_apc_bin_dumpfile(0, uninit_null(), "");
|
||||
} catch (const NotSupportedException& e) {
|
||||
return Count(true);
|
||||
}
|
||||
return Count(false);
|
||||
}
|
||||
|
||||
bool TestExtApc::test_apc_bin_loadfile() {
|
||||
try {
|
||||
f_apc_bin_loadfile("");
|
||||
} catch (const NotSupportedException& e) {
|
||||
return Count(true);
|
||||
}
|
||||
return Count(false);
|
||||
}
|
||||
|
||||
bool TestExtApc::test_apc_exists() {
|
||||
f_apc_store(s_ts, s_TestString);
|
||||
VS(f_apc_exists(s_ts), true);
|
||||
VS(f_apc_exists(s_TestString), false);
|
||||
VS(f_apc_exists(CREATE_VECTOR2(s_ts, s_TestString)), CREATE_VECTOR1(s_ts));
|
||||
return Count(true);
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| HipHop for PHP |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2010-2013 Facebook, Inc. (http://www.facebook.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_01.txt |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#ifndef incl_HPHP_TEST_EXT_APC_H_
|
||||
#define incl_HPHP_TEST_EXT_APC_H_
|
||||
|
||||
// >>>>>> Generated by idl.php. Do NOT modify. <<<<<<
|
||||
|
||||
#include "hphp/test/ext/test_cpp_ext.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class TestExtApc : public TestCppExt {
|
||||
public:
|
||||
virtual bool RunTests(const std::string &which);
|
||||
|
||||
bool test_apc();
|
||||
bool test_apc_add();
|
||||
bool test_apc_store();
|
||||
bool test_apc_fetch();
|
||||
bool test_apc_delete();
|
||||
bool test_apc_compile_file();
|
||||
bool test_apc_cache_info();
|
||||
bool test_apc_clear_cache();
|
||||
bool test_apc_define_constants();
|
||||
bool test_apc_load_constants();
|
||||
bool test_apc_sma_info();
|
||||
bool test_apc_filehits();
|
||||
bool test_apc_delete_file();
|
||||
bool test_apc_inc();
|
||||
bool test_apc_dec();
|
||||
bool test_apc_cas();
|
||||
bool test_apc_bin_dump();
|
||||
bool test_apc_bin_load();
|
||||
bool test_apc_bin_dumpfile();
|
||||
bool test_apc_bin_loadfile();
|
||||
bool test_apc_exists();
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // incl_HPHP_TEST_EXT_APC_H_
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
apache_note("blarb", "foo");
|
||||
if (apache_note("blarb", "smurf") === "foo") {
|
||||
echo "ok\n";
|
||||
}
|
||||
if (apache_note("blarb") === "smurf") {
|
||||
echo "ok\n";
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
ok
|
||||
ok
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
if (ini_get("apc.enabled") === "1") {
|
||||
echo "ok\n";
|
||||
}
|
||||
if (ini_get("apc.enable_cli") === "1") {
|
||||
echo "ok\n";
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
ok
|
||||
ok
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
apc_store("ts", "TestString");
|
||||
if (apc_exists("ts") !== true) echo "no\n";
|
||||
if (apc_exists("TestString") !== false) echo "no\n";
|
||||
if (apc_exists(array("ts", "TestString") !== array("ts"))) echo "no\n";
|
||||
echo "ok\n";
|
||||
@@ -0,0 +1 @@
|
||||
ok
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
apc_add("ts", "TestString");
|
||||
apc_add("ta", array("a" => 1, "b" => 2));
|
||||
apc_add("ts", "NewValue");
|
||||
apc_add("ta", array("newelement"));
|
||||
if (apc_fetch("ts") !== "TestString") {
|
||||
echo "no1\n";
|
||||
}
|
||||
if (apc_fetch("ta") !== array("a" => 1, "b" => 2)) {
|
||||
echo "no2\n";
|
||||
}
|
||||
|
||||
if (apc_fetch("ts") !== "TestString") {
|
||||
echo "no3\n";
|
||||
}
|
||||
if (apc_fetch("ta") !== array("a" => 1, "b" => 2)) {
|
||||
echo "no4\n";
|
||||
}
|
||||
|
||||
apc_add("texp", "TestString", 1);
|
||||
sleep(1);
|
||||
if (apc_fetch("texp") !== false) {
|
||||
echo "no5\n";
|
||||
}
|
||||
|
||||
$ret = apc_store("foo", false);
|
||||
if ($ret !== true) {
|
||||
echo "no6\n";
|
||||
}
|
||||
$ret = apc_add("foo", false);
|
||||
if ($ret !== false) {
|
||||
echo "no7\n";
|
||||
}
|
||||
$ret = apc_fetch("foo", &$success);
|
||||
if ($ret !== false) {
|
||||
echo "no8\n";
|
||||
}
|
||||
if ($success !== true) {
|
||||
echo "no9\n";
|
||||
}
|
||||
$ret = apc_fetch("bar", &$success);
|
||||
if ($ret !== false) {
|
||||
echo "no10\n";
|
||||
}
|
||||
if ($success !== false) {
|
||||
echo "no11\n";
|
||||
}
|
||||
|
||||
$map1 = array("foo" => false);
|
||||
$ret = apc_fetch(array("foo"), &$success);
|
||||
if ($ret !== $map1) {
|
||||
echo "no12\n";
|
||||
}
|
||||
$ret = apc_fetch(array("bar"), &$success);
|
||||
if ($ret !== array()) {
|
||||
echo "no13\n";
|
||||
}
|
||||
if ($success !== false) echo "no14\n";
|
||||
$ret = apc_fetch(array("foo", "bar"), &$success);
|
||||
if ($ret !== $map1) echo "no15\n";
|
||||
if ($success !== true) echo "no16\n";
|
||||
$ret = apc_fetch(array("foo", "bar", "foo", "bar"), &$success);
|
||||
if ($ret !== $map1) echo "no17\n";
|
||||
if ($success !== true) echo "no18\n";
|
||||
|
||||
echo "ok\n";
|
||||
@@ -0,0 +1 @@
|
||||
ok
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
$complexMap = array(
|
||||
"a" => array("b" => 1,
|
||||
"c" => array("d", "e")),
|
||||
"f" => array(1,2,3),
|
||||
);
|
||||
|
||||
apc_store("complexMap", $complexMap);
|
||||
apc_store("ts", "TestString");
|
||||
apc_store("ta", array("a" => 1, "b" => 2));
|
||||
apc_store("ts", "NewValue");
|
||||
apc_store("ta", array("newelement"));
|
||||
if (apc_fetch("ts") !== "NewValue") echo "no\n";
|
||||
if (apc_fetch("ta") !== array("newelement")) echo "no\n";
|
||||
if (apc_fetch("complexMap") !== $complexMap) echo "no\n";
|
||||
|
||||
if (apc_fetch("ts") !== "NewValue") echo "no\n";
|
||||
if (apc_fetch("ta") !== array("newelement")) echo "no\n";
|
||||
if (apc_fetch("complexMap") !== $complexMap) echo "no\n";
|
||||
|
||||
// Make sure it doesn't change the shared value.
|
||||
$complexMapFetched = apc_fetch("complexMap");
|
||||
if (!isset($complexMapFetched['a'])) echo "no\n";
|
||||
$complexMapFetched['q'] = 0;
|
||||
if (!isset($complexMapFetched['q'])) echo "no\n";
|
||||
if (apc_fetch("complexMap") !== $complexMap) echo "no\n";
|
||||
|
||||
$tsFetched = apc_fetch("ts");
|
||||
if ($tsFetched !== "NewValue") echo "no\n";
|
||||
$sharedString = $tsFetched;
|
||||
$tsFetched[0] = "M";
|
||||
if ($tsFetched !== "MewValue") echo "no\n";
|
||||
if ($sharedString !== "NewValue") echo "no\n";
|
||||
if (apc_fetch("ts") !== "NewValue") echo "no\n";
|
||||
|
||||
echo "ok\n";
|
||||
@@ -0,0 +1 @@
|
||||
ok
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
// reproducing a memory leak (3/26/09)
|
||||
apc_add("apcdata", array("a" => "test", "b" => 1)); // MapVariant
|
||||
|
||||
$apcdata = apc_fetch("apcdata");
|
||||
$c = $apcdata; // bump up ref count to make a MapVariant copy
|
||||
$apcdata["b"] = 3; // problem
|
||||
if ($apcdata !== array("a" => "test", "b" => 3)) echo "no\n";
|
||||
unset($apcdata);
|
||||
|
||||
$apcdata = apc_fetch("apcdata");
|
||||
$apcdata += array("b" => 4); // problem
|
||||
if ($apcdata !== array("a" => "test", "b" => 1)) echo "no\n";
|
||||
unset($apcdata);
|
||||
|
||||
$apcdata = apc_fetch(array("apcdata", "nah"));
|
||||
if ($apcdata !== array("apcdata" => array("a" => "test", "b" => 1))) {
|
||||
echo "no\n";
|
||||
}
|
||||
|
||||
echo "ok\n";
|
||||
@@ -0,0 +1 @@
|
||||
ok
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
apc_store("ts", "TestString");
|
||||
apc_store("ta", array("a" => 1, "b" => 2));
|
||||
apc_delete("ts");
|
||||
apc_delete("ta");
|
||||
if (apc_fetch("ts") !== false) echo "no\n";
|
||||
if (apc_fetch("ta") !== false) echo "no\n";
|
||||
|
||||
if (apc_fetch("ts") !== false) echo "no\n";
|
||||
if (apc_fetch("ta") !== false) echo "no\n";
|
||||
|
||||
apc_store("ts", "TestString");
|
||||
apc_store("ta", array("a" => 1, "b" => 2));
|
||||
if (apc_delete(array("ts", "ta")) !== array()) echo "no\n";
|
||||
if (apc_fetch("ts") !== false) echo "no\n";
|
||||
if (apc_fetch("ta") !== false) echo "no\n";
|
||||
echo "ok\n";
|
||||
@@ -0,0 +1 @@
|
||||
ok
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
apc_store("ts", "TestString");
|
||||
apc_store("ta", array("a" => 1, "b" => 2));
|
||||
|
||||
apc_clear_cache();
|
||||
if (apc_fetch("ts") !== false) echo "no\n";
|
||||
if (apc_fetch("ta") !== false) echo "no\n";
|
||||
|
||||
if (apc_fetch("ts") !== false) echo "no\n";
|
||||
if (apc_fetch("ta") !== false) echo "no\n";
|
||||
|
||||
echo "ok\n";
|
||||
@@ -0,0 +1 @@
|
||||
ok
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
apc_store("ts", 12);
|
||||
if (apc_inc("ts") !== 13) echo "no\n";
|
||||
if (apc_inc("ts", 5) !== 18) echo "no\n";
|
||||
if (apc_inc("ts", -3) !== 15) echo "no\n";
|
||||
echo "ok\n";
|
||||
@@ -0,0 +1 @@
|
||||
ok
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
apc_store("ts", 12);
|
||||
if (apc_dec("ts") !== 11) echo "no\n";
|
||||
if (apc_dec("ts", 5) !== 6) echo "no\n";
|
||||
if (apc_dec("ts", -3) !== 9) echo "no\n";
|
||||
echo "ok\n";
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
ok
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
apc_store("ts", 12);
|
||||
apc_cas("ts", 12, 15);
|
||||
if (apc_fetch("ts") !== 15) echo "no\n";
|
||||
apc_cas("ts", 12, 18);
|
||||
if (apc_fetch("ts") !== 15) echo "no\n";
|
||||
echo "ok\n";
|
||||
@@ -0,0 +1 @@
|
||||
ok
|
||||
Referência em uma Nova Issue
Bloquear um usuário