diff options
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | tests/cpp/include/ini_entries/001.h | 34 | ||||
-rw-r--r-- | tests/cpp/main.cpp | 8 | ||||
-rw-r--r-- | tests/php/dbg.php | 8 | ||||
-rwxr-xr-x | tests/php/php_alias.sh | 2 | ||||
-rw-r--r-- | tests/php/phpt/ini_entries/001.phpt | 19 | ||||
-rw-r--r-- | tests/php/phpt/ini_entries/002.phpt | 69 | ||||
-rw-r--r-- | tests/php/phpt/ini_entries/003.phpt | 27 |
8 files changed, 140 insertions, 30 deletions
@@ -155,6 +155,9 @@ hhvmcpp: ${HHVM_LIBRARY} ${PHP_LIBRARY}: ${COMMON_OBJECTS} ${PHP_OBJECTS} ${LINKER} ${PHP_LINKER_FLAGS} -o $@ ${COMMON_OBJECTS} ${PHP_OBJECTS} + @echo + @echo "Build complete." + @echo "Don't forget to run 'make test'." ${HHVM_LIBRARY}: ${COMMON_OBJECTS} ${HHVM_OBJECTS} ${LINKER} ${HHVM_LINKER_FLAGS} -o $@ ${COMMON_OBJECTS} ${HHVM_OBJECTS} diff --git a/tests/cpp/include/ini_entries/001.h b/tests/cpp/include/ini_entries/001.h index ece2aa4..8a4c5ca 100644 --- a/tests/cpp/include/ini_entries/001.h +++ b/tests/cpp/include/ini_entries/001.h @@ -10,33 +10,19 @@ */ namespace TestIniEntries { - + // will be retrieved at boot extension + double ini6val = 0.0; + void iniTest1(Php::Parameters ¶ms) { - /* - .add(Php::Ini(, "valIni1")) - .add(Php::Ini("ini2", "valIni2", "OrigValIni2")) - .add(Php::Ini("ini3", "valIni3", "OrigValIni3", Php::Ini::System)) - .add(Php::Ini("ini4", true, false, Php::Ini::Place::User)) - .add(Php::Ini("ini5", false)); - - Ini::get("ini1") - */ - - Php::out << "ini_get(ini1) = {{" << Php::ini_get("ini1") << " | " << Php::ini_get_orig("ini1") << "}}" << std::endl; - Php::out << "ini_get(ini2) = {{" << Php::ini_get("ini2") << " | " << Php::ini_get_orig("ini2") << "}}" << std::endl; - Php::out << "ini_get(ini3) = {{" << Php::ini_get("ini3") << " | " << Php::ini_get_orig("ini3") << "}}" << std::endl; - Php::out << "ini_get(ini4) = {{" << Php::ini_get("ini4") << " | " << Php::ini_get_orig("ini4") << "}}" << std::endl; - /* - Php::out << "extension_for_tests.some_string ={{" << Php::ini_get("extension_for_tests.some_string") << "}}" << std::endl; - Php::out << "extension_for_tests.some_string2 ={{" << Php::ini_get("extension_for_tests.some_string2") << "}}" << std::endl; - Php::out << "extension_for_tests.some_string3 ={{" << Php::ini_get("extension_for_tests.some_string3") << "}}" << std::endl; - Php::out << "extension_for_tests.some_string3 ={{" << Php::ini_get("extension_for_tests.some_bool") << "}}" << std::endl; - */ - - + Php::out << "ini_get(ini1) = " << Php::ini_get("ini1") << std::endl; + Php::out << "ini_get(ini2) = " << Php::ini_get("ini2") << std::endl; + Php::out << "ini_get(ini3) = " << Php::ini_get("ini3") << std::endl; + Php::out << "ini_get(ini4) = " << Php::ini_get("ini4") << std::endl; + Php::out << "ini_get(ini5) = " << Php::ini_get("ini5") << std::endl; + Php::out << "ini_get(ini6) = " << Php::ini_get("ini6") << std::endl; - return; + Php::out << "ini6val = " << ini6val << std::endl; } /** * End of namespace diff --git a/tests/cpp/main.cpp b/tests/cpp/main.cpp index 8583aec..f73a69a 100644 --- a/tests/cpp/main.cpp +++ b/tests/cpp/main.cpp @@ -154,10 +154,10 @@ extern "C" extension.add("TestIniEntries\\iniTest1", TestIniEntries::iniTest1); - //extension.onStartup([](){ - // Php::out << "ini_get(ini1) = {{" << Php::ini_get("ini1") << " | " << Php::ini_get_orig("ini1") << "}}" << std::endl; - // Php::out << "ini_get(ini2) = {{" << Php::ini_get("ini2") << " | " << Php::ini_get_orig("ini2") << "}}" << std::endl; - //}); + extension.onStartup([](){ + // Retrieve a value at boot extension + TestIniEntries::ini6val = Php::ini_get("ini6"); + }); diff --git a/tests/php/dbg.php b/tests/php/dbg.php index 70e71ef..b12da13 100644 --- a/tests/php/dbg.php +++ b/tests/php/dbg.php @@ -11,9 +11,15 @@ - TestIniEntries\iniTest1(); +/* exit; +ini_restore ( 'ini1' ); +ini_restore ( 'ini2' ); +ini_restore ( 'ini3' ); +TestIniEntries\iniTest1(); +*/ +//exit; echo "\x1b[1;31m"; (new ReflectionExtension('extension_for_tests') )->info(); echo "\x1b[0m"; diff --git a/tests/php/php_alias.sh b/tests/php/php_alias.sh index 6947325..4393172 100755 --- a/tests/php/php_alias.sh +++ b/tests/php/php_alias.sh @@ -16,4 +16,4 @@ fi LD_LIBRARY_PATH="$(cd $PWD/../.. && echo $PWD):${LD_LIBRARY_PATH}" export LD_LIBRARY_PATH -/usr/bin/php -d extension_dir=../ext_dir -d extension=extfortest.so -d ini7=47 -d extension_for_tests.frcli=frcli $1 $2 $3 $4 $5 +/usr/bin/php -d extension_dir=../ext_dir -d extension=extfortest.so -d ini7=47 -d ini1=ReValIni1 -d ini2=ReValIni2 $1 $2 $3 $4 $5 diff --git a/tests/php/phpt/ini_entries/001.phpt b/tests/php/phpt/ini_entries/001.phpt new file mode 100644 index 0000000..e85af06 --- /dev/null +++ b/tests/php/phpt/ini_entries/001.phpt @@ -0,0 +1,19 @@ +--TEST-- +Test ini entries #1 +--SKIPIF-- +<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> +--INI-- +ini2=ReValIni2 +--FILEEOF-- +<?php + +TestIniEntries\iniTest1(); + +--EXPECT-- +ini_get(ini1) = valIni1 +ini_get(ini2) = ReValIni2 +ini_get(ini3) = valIni3 +ini_get(ini4) = On +ini_get(ini5) = Off +ini_get(ini6) = 55 +ini6val = 55
\ No newline at end of file diff --git a/tests/php/phpt/ini_entries/002.phpt b/tests/php/phpt/ini_entries/002.phpt new file mode 100644 index 0000000..04b1b46 --- /dev/null +++ b/tests/php/phpt/ini_entries/002.phpt @@ -0,0 +1,69 @@ +--TEST-- +Test ini entries #2 +--SKIPIF-- +<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> +--INI-- +ini2=ReValIni2 +ini6=33 +--FILEEOF-- +<?php + +var_export( ini_get_all ( 'extension_for_tests' ) ); + +--EXPECT-- +array ( + 'ini1' => + array ( + 'global_value' => 'valIni1', + 'local_value' => 'valIni1', + 'access' => 7, + ), + 'ini2' => + array ( + 'global_value' => 'OrigValIni2', + 'local_value' => 'ReValIni2', + 'access' => 7, + ), + 'ini3' => + array ( + 'global_value' => 'OrigValIni3', + 'local_value' => 'valIni3', + 'access' => 4, + ), + 'ini4' => + array ( + 'global_value' => 'Off', + 'local_value' => 'On', + 'access' => 1, + ), + 'ini5' => + array ( + 'global_value' => 'Off', + 'local_value' => 'Off', + 'access' => 7, + ), + 'ini6' => + array ( + 'global_value' => '11', + 'local_value' => '33', + 'access' => 7, + ), + 'ini7' => + array ( + 'global_value' => '5', + 'local_value' => '74', + 'access' => 7, + ), + 'ini8' => + array ( + 'global_value' => '6.283185', + 'local_value' => '3.141593', + 'access' => 7, + ), + 'ini9' => + array ( + 'global_value' => '5.436564', + 'local_value' => '2.718282', + 'access' => 1, + ), +)
\ No newline at end of file diff --git a/tests/php/phpt/ini_entries/003.phpt b/tests/php/phpt/ini_entries/003.phpt new file mode 100644 index 0000000..5ad6efb --- /dev/null +++ b/tests/php/phpt/ini_entries/003.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test ini entries #3 +--DESCRIPTION-- +Test to check palce action of ini entries +--SKIPIF-- +<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> +--FILEEOF-- +<?php + +echo ini_get('ini2'), PHP_EOL; +echo ini_get('ini3'), PHP_EOL; +ini_set('ini2', 'newIni2'); +ini_set('ini3', 'newIni3'); +echo ini_get('ini2'), PHP_EOL; +echo ini_get('ini3'), PHP_EOL; +ini_restore('ini2'); +ini_restore('ini3'); +echo ini_get('ini2'), PHP_EOL; +echo ini_get('ini3'); + +--EXPECT-- +valIni2 +valIni3 +newIni2 +valIni3 +valIni2 +valIni3
\ No newline at end of file |