From 08ed8866a5bba0b23a8d5587116a968512df2568 Mon Sep 17 00:00:00 2001 From: valmat Date: Tue, 8 Apr 2014 08:53:35 +0600 Subject: Ini entries emplemented (issues #64) --- tests/cpp/h/ini_entries.h | 16 +++++++++++ tests/cpp/include/ini_entries/001.h | 29 ++++++++++++++++++++ tests/cpp/main.cpp | 28 +++++++++++++++++++ tests/php/dbg.php | 54 +++++++++++++++++++++++++++++-------- tests/php/php_alias.sh | 2 +- 5 files changed, 117 insertions(+), 12 deletions(-) create mode 100644 tests/cpp/h/ini_entries.h create mode 100644 tests/cpp/include/ini_entries/001.h (limited to 'tests') diff --git a/tests/cpp/h/ini_entries.h b/tests/cpp/h/ini_entries.h new file mode 100644 index 0000000..a6fb10e --- /dev/null +++ b/tests/cpp/h/ini_entries.h @@ -0,0 +1,16 @@ +/** + * + * Test ini entries + * + */ + + +#include "../include/ini_entries/001.h" +//#include "../include/ini_entries/.h" +//#include "../include/ini_entries/.h" + + + + + + diff --git a/tests/cpp/include/ini_entries/001.h b/tests/cpp/include/ini_entries/001.h new file mode 100644 index 0000000..649b0bd --- /dev/null +++ b/tests/cpp/include/ini_entries/001.h @@ -0,0 +1,29 @@ +/** + * + * Test ini entries + * test ini_entries/001.phpt + * + */ + +/** + * Set up namespace + */ +namespace TestIniEntries { + + + void iniTest1(Php::Parameters ¶ms) + { + 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; + + + + return; + } +/** + * End of namespace + */ +} + diff --git a/tests/cpp/main.cpp b/tests/cpp/main.cpp index 84d95d8..c563c8d 100644 --- a/tests/cpp/main.cpp +++ b/tests/cpp/main.cpp @@ -11,6 +11,7 @@ #include "h/ValueIterator.h" #include "h/Classes_and_objects.h" #include "h/variables.h" +#include "h/ini_entries.h" @@ -128,6 +129,33 @@ extern "C" extension.add(std::move(cObj2Scalar)); + extension + .add(Php::Ini("ini1", "valIni1")) + .add(Php::Ini("ini2", "valIni2", "OrigValIni2")) + .add(Php::Ini("ini3", "valIni3", "OrigValIni3", Php::Ini::Place::System)) + .add(Php::Ini("ini4", true, false, Php::Ini::Place::User)) + .add(Php::Ini("ini5", false)); + + Php::Ini ini6("ini6", 55, 11); + extension + .add(ini6) + .add(Php::Ini("ini7", 74)); + + Php::Ini ini8("ini8", 3.1415926, 6.2831852); + Php::Ini ini9("ini9", 2.7182818, 5.4365636, Php::Ini::Place::User); + extension.add(ini8); + extension.add(std::move(ini9)); + + + + + /** + * tests ini entries + * + */ + extension.add("TestIniEntries\\iniTest1", TestIniEntries::iniTest1); + + diff --git a/tests/php/dbg.php b/tests/php/dbg.php index 003c494..8de0bb8 100644 --- a/tests/php/dbg.php +++ b/tests/php/dbg.php @@ -13,14 +13,46 @@ -var_dump( TestBaseClass\MyClass::CONSTANT1 ); -var_dump( TestBaseClass\MyClass::EXP ); -var_dump( TestBaseClass\MyClass::CONSTANT2 ); -var_dump( TestBaseClass\MyClass::CONSTANT3 ); - -var_dump( TestBaseClass\MyClass::$StatProp1 ); -var_dump( TestBaseClass\MyClass::$Exp ); -var_dump( TestBaseClass\MyClass::$StatProp2 ); -var_dump( TestBaseClass\MyClass::$StatProp3 ); -TestBaseClass\MyClass::$StatProp2 = "otherval"; -var_dump( TestBaseClass\MyClass::$StatProp2 ); +echo "\x1b[1;31m"; +(new ReflectionExtension('extension_for_tests') )->info(); +echo "\x1b[0m"; +echo "\x1b[0;34m"; +var_export( ini_get_all ( 'extension_for_tests' ) ); +echo "\x1b[0m", PHP_EOL; +exit; + +TestIniEntries\iniTest1(); + +//ini_set("extension_for_tests.some_string3", 'RFVBGT') ; +echo PHP_EOL; +echo "extension_for_tests.some_string ={{" , ini_get("extension_for_tests.some_string") , "}}", PHP_EOL; +echo "extension_for_tests.some_string2 ={{" , ini_get("extension_for_tests.some_string2") , "}}", PHP_EOL; +echo "extension_for_tests.some_string3 ={{" , ini_get("extension_for_tests.some_string3") , "}}", PHP_EOL; +echo "extension_for_tests.some_string3 ={{" , ini_get("extension_for_tests.some_bool") , "}}", PHP_EOL; + + +echo "\x1b[1;31m"; +(new ReflectionExtension('extension_for_tests') )->info(); +echo "\x1b[0m"; + +echo "\x1b[0;34m"; +var_export( ini_get_all ( 'extension_for_tests' ) ); +echo "\x1b[0m", PHP_EOL; + +ini_set("extension_for_tests.some_string3", 'RFVBGT') ; +echo "extension_for_tests.some_string3 ={{" , ini_get("extension_for_tests.some_string3") , "}}", PHP_EOL; +ini_restore ( 'extension_for_tests.some_string3' ); +echo "extension_for_tests.some_string3 ={{" , ini_get("extension_for_tests.some_string3") , "}}", PHP_EOL; + + +echo "extension_for_tests.some_bool :"; +var_dump(ini_get("extension_for_tests.some_bool")); +echo PHP_EOL; + +ini_set("extension_for_tests.some_bool", 'off'); + +echo "extension_for_tests.some_bool :"; +var_dump(ini_get("extension_for_tests.some_bool")); +echo PHP_EOL; + +//var_export(php_sapi_name()); diff --git a/tests/php/php_alias.sh b/tests/php/php_alias.sh index f4c7f8f..6947325 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 $1 +/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 -- cgit v1.2.3