diff --git a/hphp/test/ext/test_ext.h b/hphp/test/ext/test_ext.h index 0c3ec59cd..7e9e4aa10 100644 --- a/hphp/test/ext/test_ext.h +++ b/hphp/test/ext/test_ext.h @@ -39,7 +39,6 @@ #include "hphp/test/ext/test_ext_memcached.h" #include "hphp/test/ext/test_ext_mysql.h" #include "hphp/test/ext/test_ext_openssl.h" -#include "hphp/test/ext/test_ext_output.h" #include "hphp/test/ext/test_ext_pdo.h" #include "hphp/test/ext/test_ext_posix.h" #include "hphp/test/ext/test_ext_process.h" diff --git a/hphp/test/ext/test_ext_output.cpp b/hphp/test/ext/test_ext_output.cpp deleted file mode 100644 index e77db4010..000000000 --- a/hphp/test/ext/test_ext_output.cpp +++ /dev/null @@ -1,227 +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_output.h" -#include "hphp/runtime/ext/ext_output.h" - -IMPLEMENT_SEP_EXTENSION_TEST(Output); -/////////////////////////////////////////////////////////////////////////////// - -bool TestExtOutput::RunTests(const std::string &which) { - bool ret = true; - - DECLARE_TEST_FUNCTIONS("function mytolower($a) {" - " return strtolower($a);" - "}"); - - RUN_TEST(test_ob_start); - RUN_TEST(test_ob_clean); - RUN_TEST(test_ob_flush); - RUN_TEST(test_ob_end_clean); - RUN_TEST(test_ob_end_flush); - RUN_TEST(test_flush); - RUN_TEST(test_ob_get_clean); - RUN_TEST(test_ob_get_contents); - RUN_TEST(test_ob_get_flush); - RUN_TEST(test_ob_get_length); - RUN_TEST(test_ob_get_level); - RUN_TEST(test_ob_get_status); - RUN_TEST(test_ob_gzhandler); - RUN_TEST(test_ob_implicit_flush); - RUN_TEST(test_ob_list_handlers); - RUN_TEST(test_output_add_rewrite_var); - RUN_TEST(test_output_reset_rewrite_vars); - RUN_TEST(test_hphp_crash_log); - RUN_TEST(test_hphp_stats); - RUN_TEST(test_hphp_get_stats); - RUN_TEST(test_hphp_get_timers); - RUN_TEST(test_hphp_output_global_state); - - return ret; -} - -/////////////////////////////////////////////////////////////////////////////// - -bool TestExtOutput::test_ob_start() { - f_ob_start(); - f_ob_start("mytolower"); - g_context->write("TEst"); - f_ob_end_flush(); - VS(f_ob_get_clean(), "test"); - return Count(true); -} - -bool TestExtOutput::test_ob_clean() { - f_ob_start(); - g_context->write("test"); - f_ob_clean(); - VS(f_ob_get_clean(), ""); - return Count(true); -} - -bool TestExtOutput::test_ob_flush() { - f_ob_start(); - f_ob_start("mytolower"); - g_context->write("TEst"); - f_ob_flush(); - VS(f_ob_get_clean(), ""); - VS(f_ob_get_clean(), "test"); - return Count(true); -} - -bool TestExtOutput::test_ob_end_clean() { - f_ob_start(); - f_ob_start("mytolower"); - g_context->write("TEst"); - f_ob_end_clean(); - VS(f_ob_get_clean(), ""); - return Count(true); -} - -bool TestExtOutput::test_ob_end_flush() { - f_ob_start(); - f_ob_start("mytolower"); - g_context->write("TEst"); - f_ob_end_flush(); - VS(f_ob_get_clean(), "test"); - return Count(true); -} - -bool TestExtOutput::test_flush() { - f_ob_start(); - f_ob_start("mytolower"); - g_context->write(""); // we can't really verify what's written to stdout - f_flush(); - f_ob_end_clean(); - f_ob_end_clean(); - return Count(true); -} - -bool TestExtOutput::test_ob_get_clean() { - f_ob_start(); - f_ob_start(); - g_context->write("test"); - VS(f_ob_get_clean(), "test"); - VS(f_ob_get_clean(), ""); - VS(f_ob_get_clean(), ""); - return Count(true); -} - -bool TestExtOutput::test_ob_get_contents() { - f_ob_start(); - g_context->write("test"); - VS(f_ob_get_contents(), "test"); - VS(f_ob_get_contents(), "test"); // verifying content stays - f_ob_end_clean(); - return Count(true); -} - -bool TestExtOutput::test_ob_get_flush() { - f_ob_start(); - f_ob_start(); - g_context->write("test"); - VS(f_ob_get_flush(), "test"); - VS(f_ob_get_flush(), ""); - f_ob_end_clean(); - VS(f_ob_get_flush(), "test"); - f_ob_end_clean(); - return Count(true); -} - -bool TestExtOutput::test_ob_get_length() { - f_ob_start(); - g_context->write("test"); - VS(f_ob_get_length(), 4); - f_ob_end_clean(); - return Count(true); -} - -bool TestExtOutput::test_ob_get_level() { - VS(f_ob_get_level(), 0); - f_ob_start(); - VS(f_ob_get_level(), 1); - f_ob_end_clean(); - VS(f_ob_get_level(), 0); - return Count(true); -} - -bool TestExtOutput::test_ob_get_status() { - f_ob_get_status(); - return Count(true); -} - -bool TestExtOutput::test_ob_gzhandler() { - try { - f_ob_gzhandler("value", 0); - } catch (const NotSupportedException& e) { - return Count(true); - } - return Count(false); -} - -bool TestExtOutput::test_ob_implicit_flush() { - f_ob_implicit_flush(true); // no-op currently - f_ob_implicit_flush(false); // no-op currently - return Count(true); -} - -bool TestExtOutput::test_ob_list_handlers() { - f_ob_start(); - f_ob_start("test"); - Array handlers = f_ob_list_handlers(); - f_ob_end_clean(); - f_ob_end_clean(); - VS(handlers, CREATE_VECTOR2(uninit_null(), "test")); - return Count(true); -} - -bool TestExtOutput::test_output_add_rewrite_var() { - try { - f_output_add_rewrite_var("name", "value"); - } catch (const NotSupportedException& e) { - return Count(true); - } - return Count(false); -} - -bool TestExtOutput::test_output_reset_rewrite_vars() { - try { - f_output_reset_rewrite_vars(); - } catch (const NotSupportedException& e) { - return Count(true); - } - return Count(false); -} - -bool TestExtOutput::test_hphp_crash_log() { - return Count(true); -} - -bool TestExtOutput::test_hphp_stats() { - return Count(true); -} - -bool TestExtOutput::test_hphp_get_stats() { - return Count(true); -} - -bool TestExtOutput::test_hphp_get_timers() { - return Count(true); -} - -bool TestExtOutput::test_hphp_output_global_state() { - return Count(true); -} diff --git a/hphp/test/ext/test_ext_output.h b/hphp/test/ext/test_ext_output.h deleted file mode 100644 index 5f0e5454a..000000000 --- a/hphp/test/ext/test_ext_output.h +++ /dev/null @@ -1,56 +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_OUTPUT_H_ -#define incl_HPHP_TEST_EXT_OUTPUT_H_ - -// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< - -#include "hphp/test/ext/test_cpp_ext.h" - -/////////////////////////////////////////////////////////////////////////////// - -class TestExtOutput : public TestCppExt { - public: - virtual bool RunTests(const std::string &which); - - bool test_ob_start(); - bool test_ob_clean(); - bool test_ob_flush(); - bool test_ob_end_clean(); - bool test_ob_end_flush(); - bool test_flush(); - bool test_ob_get_clean(); - bool test_ob_get_contents(); - bool test_ob_get_flush(); - bool test_ob_get_length(); - bool test_ob_get_level(); - bool test_ob_get_status(); - bool test_ob_gzhandler(); - bool test_ob_implicit_flush(); - bool test_ob_list_handlers(); - bool test_output_add_rewrite_var(); - bool test_output_reset_rewrite_vars(); - bool test_hphp_crash_log(); - bool test_hphp_stats(); - bool test_hphp_get_stats(); - bool test_hphp_get_timers(); - bool test_hphp_output_global_state(); -}; - -/////////////////////////////////////////////////////////////////////////////// - -#endif // incl_HPHP_TEST_EXT_OUTPUT_H_ diff --git a/hphp/test/slow/ext_output/ext_output.php b/hphp/test/slow/ext_output/ext_output.php new file mode 100644 index 000000000..6d2e88426 --- /dev/null +++ b/hphp/test/slow/ext_output/ext_output.php @@ -0,0 +1,89 @@ +