summaryrefslogtreecommitdiff
path: root/tests/cpp
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2015-11-05 10:25:57 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2015-11-05 10:25:57 +0100
commitaec191bc6cbb83884466800a750ecad0b37e254f (patch)
treef52fe2b9551056580c5c519fb78a3c5600e1034a /tests/cpp
parentaf530282f530580c1ed7bc184df0a727068275e1 (diff)
remove test framework, it never works, most of the bugs found by the test framework turn out to be caused by errors in the tests instead of errors in the real code, people complain about it all the time, and basically this whole test framework causes more problems than it solves, solves issue #215 and solves issue #221
Diffstat (limited to 'tests/cpp')
-rw-r--r--tests/cpp/Makefile139
-rw-r--r--tests/cpp/h/Classes_and_objects.h14
-rw-r--r--tests/cpp/h/ValueIterator.h8
-rw-r--r--tests/cpp/h/ini_entries.h16
-rw-r--r--tests/cpp/h/variables.h37
-rw-r--r--tests/cpp/include/bool2str.h12
-rw-r--r--tests/cpp/include/class_obj/001-002.h66
-rw-r--r--tests/cpp/include/class_obj/003-comparable.h74
-rw-r--r--tests/cpp/include/class_obj/004-static-funct.h90
-rw-r--r--tests/cpp/include/class_obj/tpl.h25
-rw-r--r--tests/cpp/include/doubl2str.h15
-rw-r--r--tests/cpp/include/ini_entries/001.h31
-rw-r--r--tests/cpp/include/valueiterator/001-006.h27
-rw-r--r--tests/cpp/include/valueiterator/007.h44
-rw-r--r--tests/cpp/include/variables/001-process_globals.h57
-rw-r--r--tests/cpp/include/variables/002-get_complex_array.h35
-rw-r--r--tests/cpp/include/variables/003-value-types.h37
-rw-r--r--tests/cpp/include/variables/004-store-scalar-variables.h48
-rw-r--r--tests/cpp/include/variables/005-cast-objects-to-scalars.h75
-rw-r--r--tests/cpp/include/variables/006-casting-obj2str.h30
-rw-r--r--tests/cpp/include/variables/007-overloaded-operators.h46
-rw-r--r--tests/cpp/include/variables/008-value-arrays.h57
-rw-r--r--tests/cpp/include/variables/009-010-value-object.h68
-rw-r--r--tests/cpp/include/variables/011-012-value-casting-operators.h52
-rw-r--r--tests/cpp/include/variables/013-018-calling-php-functions.h117
-rw-r--r--tests/cpp/include/variables/019-HashMember-1.h33
-rw-r--r--tests/cpp/include/variables/020-HashMember-2.h41
-rw-r--r--tests/cpp/include/variables/021-HashMember-3.h41
-rw-r--r--tests/cpp/include/variables/022-HashMember-4.h65
-rw-r--r--tests/cpp/include/variables/023-cookie.h31
-rw-r--r--tests/cpp/include/variables/024-get-post.h38
-rw-r--r--tests/cpp/include/variables/025-post-raw1.h41
-rw-r--r--tests/cpp/include/variables/026-post-raw2.h76
-rw-r--r--tests/cpp/include/variables/027-env.h26
-rw-r--r--tests/cpp/include/variables/028-029-compare.h194
-rw-r--r--tests/cpp/include/variables/tpl.h29
-rw-r--r--tests/cpp/main.cpp179
-rw-r--r--tests/cpp/readme2
38 files changed, 0 insertions, 2016 deletions
diff --git a/tests/cpp/Makefile b/tests/cpp/Makefile
deleted file mode 100644
index 90b3946..0000000
--- a/tests/cpp/Makefile
+++ /dev/null
@@ -1,139 +0,0 @@
-#
-# Makefile template
-#
-# This is an example Makefile that can be used by anyone who is building
-# his or her own PHP extensions using the PHP-CPP library.
-#
-# In the top part of this file we have included variables that can be
-# altered to fit your configuration, near the bottom the instructions and
-# dependencies for the compiler are defined. The deeper you get into this
-# file, the less likely it is that you will have to change anything in it.
-#
-
-#
-# Name of your extension
-#
-# This is the name of your extension. Based on this extension name, the
-# name of the library file (name.so) and the name of the config file (name.ini)
-# are automatically generated
-#
-
-NAME = extfortest
-
-
-#
-# Php.ini directories
-#
-# In the past, PHP used a single php.ini configuration file. Today, most
-# PHP installations use a conf.d directory that holds a set of config files,
-# one for each extension. Use this variable to specify this directory.
-#
-
-# in our case it is not required
-#INI_DIR = /etc/php5/conf.d
-
-
-#
-# The extension dirs
-#
-# This is normally a directory like /usr/lib/php5/20121221 (based on the
-# PHP version that you use. We make use of the command line 'php-config'
-# instruction to find out what the extension directory is, you can override
-# this with a different fixed directory
-#
-
-EXTENSION_DIR = $(shell php-config --extension-dir)
-
-
-#
-# The name of the extension and the name of the .ini file
-#
-# These two variables are based on the name of the extension. We simply add
-# a certain extension to them (.so or .ini)
-#
-
-EXTENSION = ${NAME}.so
-# in our case it is not required
-#INI = ${NAME}.ini
-
-
-#
-# Compiler
-#
-# By default, the GNU C++ compiler is used. If you want to use a different
-# compiler, you can change that here. You can change this for both the
-# compiler (the program that turns the c++ files into object files) and for
-# the linker (the program that links all object files into the single .so
-# library file. By default, g++ (the GNU C++ compiler) is used for both.
-#
-
-COMPILER = g++
-LINKER = g++
-
-
-#
-# Compiler and linker flags
-#
-# This variable holds the flags that are passed to the compiler. By default,
-# we include the -O2 flag. This flag tells the compiler to optimize the code,
-# but it makes debugging more difficult. So if you're debugging your application,
-# you probably want to remove this -O2 flag. At the same time, you can then
-# add the -g flag to instruct the compiler to include debug information in
-# the library (but this will make the final libphpcpp.so file much bigger, so
-# you want to leave that flag out on production servers).
-#
-# If your extension depends on other libraries (and it does at least depend on
-# one: the PHP-CPP library), you should update the LINKER_DEPENDENCIES variable
-# with a list of all flags that should be passed to the linker.
-#
-
-LIB_DIR=$(shell cd ../.. && pwd)
-COMPILER_FLAGS = -Wall -c -O2 -std=c++11 -fpic -I"${LIB_DIR}/tests/include/lib" -I"${LIB_DIR}/tests/include/zts" -o
-LINKER_FLAGS = -shared -L"${LIB_DIR}"
-LINKER_DEPENDENCIES = -lphpcpp
-
-
-#
-# Command to remove files, copy files and create directories.
-#
-# I've never encountered a *nix environment in which these commands do not work.
-# So you can probably leave this as it is
-#
-
-RM = rm -f
-CP = cp -f
-MKDIR = mkdir -p
-
-
-#
-# All source files are simply all *.cpp files found in the current directory
-#
-# A builtin Makefile macro is used to scan the current directory and find
-# all source files. The object files are all compiled versions of the source
-# file, with the .cpp extension being replaced by .o.
-#
-
-SOURCES = $(wildcard *.cpp)
-OBJECTS = $(SOURCES:%.cpp=%.o)
-
-
-#
-# From here the build instructions start
-#
-
-all: ${OBJECTS} ${EXTENSION}
-
-${EXTENSION}: ${OBJECTS}
- ${LINKER} ${LINKER_FLAGS} -o $@ ${OBJECTS} ${LINKER_DEPENDENCIES}
-
-${OBJECTS}:
- ${COMPILER} ${COMPILER_FLAGS} $@ ${@:%.o=%.cpp}
-
-# Do not install this extension
-#install:
-# ${CP} ${EXTENSION} ${EXTENSION_DIR}
-# ${CP} ${INI} ${INI_DIR}
-
-clean:
- ${RM} ${EXTENSION} ${OBJECTS}
-
diff --git a/tests/cpp/h/Classes_and_objects.h b/tests/cpp/h/Classes_and_objects.h
deleted file mode 100644
index 8404c69..0000000
--- a/tests/cpp/h/Classes_and_objects.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- *
- *
- * Classes_and_objects.h
- *
- */
-
-#include "../include/class_obj/001-002.h"
-#include "../include/class_obj/003-comparable.h"
-#include "../include/class_obj/004-static-funct.h"
-//#include "../include/class_obj/.h"
-//#include "../include/class_obj/.h"
-//#include "../include/class_obj/.h"
-
diff --git a/tests/cpp/h/ValueIterator.h b/tests/cpp/h/ValueIterator.h
deleted file mode 100644
index b430008..0000000
--- a/tests/cpp/h/ValueIterator.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- *
- * TestValueIterator
- *
- */
-
-#include "../include/valueiterator/001-006.h"
-#include "../include/valueiterator/007.h"
diff --git a/tests/cpp/h/ini_entries.h b/tests/cpp/h/ini_entries.h
deleted file mode 100644
index a6fb10e..0000000
--- a/tests/cpp/h/ini_entries.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- *
- * Test ini entries
- *
- */
-
-
-#include "../include/ini_entries/001.h"
-//#include "../include/ini_entries/.h"
-//#include "../include/ini_entries/.h"
-
-
-
-
-
-
diff --git a/tests/cpp/h/variables.h b/tests/cpp/h/variables.h
deleted file mode 100644
index 0b684dd..0000000
--- a/tests/cpp/h/variables.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * Test variables
- *
- */
-
-#include "../include/doubl2str.h"
-#include "../include/bool2str.h"
-
-#include "../include/variables/001-process_globals.h"
-#include "../include/variables/002-get_complex_array.h"
-#include "../include/variables/003-value-types.h"
-#include "../include/variables/004-store-scalar-variables.h"
-#include "../include/variables/005-cast-objects-to-scalars.h"
-#include "../include/variables/006-casting-obj2str.h"
-#include "../include/variables/007-overloaded-operators.h"
-#include "../include/variables/008-value-arrays.h"
-#include "../include/variables/009-010-value-object.h"
-#include "../include/variables/011-012-value-casting-operators.h"
-#include "../include/variables/013-018-calling-php-functions.h"
-#include "../include/variables/019-HashMember-1.h"
-#include "../include/variables/020-HashMember-2.h"
-#include "../include/variables/021-HashMember-3.h"
-#include "../include/variables/022-HashMember-4.h"
-#include "../include/variables/023-cookie.h"
-#include "../include/variables/024-get-post.h"
-#include "../include/variables/025-post-raw1.h"
-#include "../include/variables/026-post-raw2.h"
-#include "../include/variables/027-env.h"
-#include "../include/variables/028-029-compare.h"
-//#include "../include/variables/.h"
-
-
-
-
-
-
diff --git a/tests/cpp/include/bool2str.h b/tests/cpp/include/bool2str.h
deleted file mode 100644
index 26aac80..0000000
--- a/tests/cpp/include/bool2str.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- *
- * bool -> string
- *
- */
-
-
-
-std::string bool2str(bool b)
-{
- return b ? "Yes" : "No";
-}
diff --git a/tests/cpp/include/class_obj/001-002.h b/tests/cpp/include/class_obj/001-002.h
deleted file mode 100644
index 2a3b4df..0000000
--- a/tests/cpp/include/class_obj/001-002.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- *
- * Test Classes and objects
- * 001.phpt
- * 002.phpt
- *
- */
-
-
-
-
-/**
- * Set up namespace
- */
-namespace TestBaseClass {
-
-
- class MyCustomClass : public Php::Base, public Php::Countable
- {
- private:
- int _x = 3;
-
- public:
- MyCustomClass()
- {
- std::cerr << "MyCustomClass::MyCustomClass()" << std::endl;
- }
-
- MyCustomClass(int value) : _x(value)
- {
- std::cerr << "MyCustomClass::MyCustomClass(" << value << ")" << std::endl;
- }
-
- MyCustomClass(const MyCustomClass &that)
- {
- //std::cerr << "MyCustomClass::MyCustomClass copy constructor" << std::endl;
- }
-
- virtual ~MyCustomClass()
- {
- std::cerr << "MyCustomClass::~MyCustomClass" << std::endl;
- }
-
- virtual long int count() override
- {
- return 33;
- }
-
- Php::Value myMethod(Php::Parameters &params)
- {
- // check number of parameters
- //if (params.size() != 1) throw Php::Exception("Invalid number of parameters supplied");
-
- Php::out << "myMethod is called for object " << _x << std::endl;
-
- return 5;
-
- }
- };
-
-
-/**
- * End of namespace
- */
-}
-
diff --git a/tests/cpp/include/class_obj/003-comparable.h b/tests/cpp/include/class_obj/003-comparable.h
deleted file mode 100644
index 8a384dc..0000000
--- a/tests/cpp/include/class_obj/003-comparable.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- *
- * Test Classes and objects
- * 003-comparable.phpt
- *
- */
-
-
-
-
-/**
- * Set up namespace
- */
-namespace TestBaseClass {
-
-
- /**
- * Test custom comparison operator
- */
- class Comparable : public Php::Base
- {
- private:
- /**
- * Internal value of the class
- * @var int
- */
- static int count;
- int _nom;
- int _value;
-
- public:
- /**
- * C++ constructor
- */
- Comparable()
- {
- // start with random value
- //_value = rand();
- _nom = ++count;
- _value = _nom%2+1;
- }
-
- /**
- * C++ destructor
- */
- virtual ~Comparable() {}
-
- /**
- * Cast the object to a string
- * @return std::string
- */
- std::string __toString()
- {
- return "Obj#" + std::to_string(_nom) + "(" + std::to_string(_value) + ")";
- }
-
- /**
- * Compare with a different object
- * @param that
- * @return int
- */
- int __compare(const Comparable &that) const
- {
- return _value - that._value;
- }
- };
- int Comparable::count = 0;
-
-
-/**
- * End of namespace
- */
-}
-
diff --git a/tests/cpp/include/class_obj/004-static-funct.h b/tests/cpp/include/class_obj/004-static-funct.h
deleted file mode 100644
index d6816ab..0000000
--- a/tests/cpp/include/class_obj/004-static-funct.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- *
- * Test Classes and objects
- * 004-static-funct.phpt
- * test static functions
- *
- */
-
-
-
-
-/**
- * Set up namespace
- */
-namespace TestBaseClass {
-
-
- /**
- * Regular function
- *
- * Because a regular function does not have a 'this' pointer,
- * it has the same signature as static methods
- *
- * @param params Parameters passed to the function
- */
- void testStaticRegFunc(Php::Parameters &params)
- {
- Php::out << "testStatic regular function"<< std::endl;
- }
-
- /**
- * A very simple class that will not be exported to PHP
- */
- class testStaticPrivClass
- {
- public:
- /**
- * C++ constructor and destructor
- */
- testStaticPrivClass() {}
- virtual ~testStaticPrivClass() {}
-
- /**
- * Static method
- *
- * A static method also has no 'this' pointer and has
- * therefore a signature identical to regular functions
- *
- * @param params Parameters passed to the method
- */
- static void staticMethod(Php::Parameters &params)
- {
- Php::out << "testStaticPrivClass::staticMethod()"<< std::endl;
- }
- };
-
- /**
- * A very simple class that will be exported to PHP
- */
- class testStaticPubClass : public Php::Base
- {
- public:
- /**
- * C++ constructor and destructor
- */
- testStaticPubClass() {}
- virtual ~testStaticPubClass() {}
-
- /**
- * Another static method
- *
- * This static has exactly the same signature as the
- * regular function and static method that were mentioned
- * before
- *
- * @param params Parameters passed to the method
- */
- static void staticMethod(Php::Parameters &params)
- {
- Php::out << "testStaticPubClass::staticMethod()"<< std::endl;
- }
- };
-
-
-
-/**
- * End of namespace
- */
-}
-
diff --git a/tests/cpp/include/class_obj/tpl.h b/tests/cpp/include/class_obj/tpl.h
deleted file mode 100644
index 7dfdcfc..0000000
--- a/tests/cpp/include/class_obj/tpl.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- *
- * Test Classes and objects
- * phptname.phpt
- *
- */
-
-
-
-
-/**
- * Set up namespace
- */
-namespace TestBaseClass {
-
-
-
-
-
-
-/**
- * End of namespace
- */
-}
-
diff --git a/tests/cpp/include/doubl2str.h b/tests/cpp/include/doubl2str.h
deleted file mode 100644
index 5c7f208..0000000
--- a/tests/cpp/include/doubl2str.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/**
- *
- * double -> string
- *
- */
-#include <sstream>
-#include <iomanip>
-std::string double2str(long double d)
-{
- std::ostringstream strs;
- strs << std::setprecision(16) << d;
- return strs.str();
-}
-
-
diff --git a/tests/cpp/include/ini_entries/001.h b/tests/cpp/include/ini_entries/001.h
deleted file mode 100644
index 8a4c5ca..0000000
--- a/tests/cpp/include/ini_entries/001.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- *
- * Test ini entries
- * test ini_entries/001.phpt
- *
- */
-
-/**
- * Set up namespace
- */
-namespace TestIniEntries {
-
- // will be retrieved at boot extension
- double ini6val = 0.0;
-
- void iniTest1(Php::Parameters &params)
- {
- 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;
-
- Php::out << "ini6val = " << ini6val << std::endl;
- }
-/**
- * End of namespace
- */
-}
-
diff --git a/tests/cpp/include/valueiterator/001-006.h b/tests/cpp/include/valueiterator/001-006.h
deleted file mode 100644
index 0dc6778..0000000
--- a/tests/cpp/include/valueiterator/001-006.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- *
- * TestValueIterator
- * test valueiterator/001.phpt-valueiterator/006.phpt
- *
- */
-
-/**
- * Set up namespace
- */
-namespace TestValueIterator {
-
-
- void loopValue(Php::Parameters &params)
- {
- std::cout << "Array/Object contains " << params[0].size() << " items" << std::endl;
- for (auto it=params[0].begin(), itend = params[0].end(); it != itend; ++it) {
- std::cout << "["<< it->first << "]="<< it->second << std::endl;
- //std::cout << "["<< it->key() << "]="<< it->value() << std::endl;
- }
- return;
- }
-/**
- * End of namespace
- */
-}
-
diff --git a/tests/cpp/include/valueiterator/007.h b/tests/cpp/include/valueiterator/007.h
deleted file mode 100644
index 3cfcb59..0000000
--- a/tests/cpp/include/valueiterator/007.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- *
- * TestValueIterator
- * test valueiterator/007.phpt
- *
- */
-
-/**
- * Set up namespace
- */
-namespace TestValueIterator {
-
- void loopArray(void)
- {
-
- Php::Value value;
- /*
- If we fill the array in this form, we get the following:
- *** Error in `/usr/bin/php': double free or corruption (fasttop): 0x0000000001956d60 ***
- value[0] = "val0";
- value[1] = "val1";
- value["third"] = "val3";
- value["fourth"] = "val3";
- */
- value.set(0 , "val0");
- value.set(1 , "val1");
- value.set("third" , "val3");
- value.set("fourth", "val3");
-
- std::cout << "Array/Object contains " << value.size() << " items" << std::endl;
- // assum the value variable holds an array or object, it then
- // is possible to iterator over the values or properties
- for (auto &iter : value)
- {
- // output key and value
- Php::out << "["<< iter.first << "]="<< iter.second << std::endl;
- }
- }
-
-/**
- * End of namespace
- */
-}
-
diff --git a/tests/cpp/include/variables/001-process_globals.h b/tests/cpp/include/variables/001-process_globals.h
deleted file mode 100644
index ae930d2..0000000
--- a/tests/cpp/include/variables/001-process_globals.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- *
- * Test variables
- * 001-process_globals.phpt
- * Global variables in PHP-CPP
- *
- */
-
-
-
-
-/**
- * Set up namespace
- */
-namespace TestVariables {
-
-
-
- /**
- * process_globals()
- *
- * This function reads and modifies global variables
- */
- Php::Value process_globals()
- {
- // all global variables can be accessed via the Php::GLOBALS variable,
- // which is more or less the same as the PHP $_GLOBALS variable
-
- // set a global variable
- Php::GLOBALS["a"] = 1;
-
- // increment a global variable
- Php::GLOBALS["b"] += 1;
-
- // set a global variable to be an array
- Php::GLOBALS["c"] = Php::Array();
-
- // add a member to an array
- Php::GLOBALS["c"]["member"] = 123;
-
- // and increment it
- Php::GLOBALS["c"]["member"] += 77;
-
- // change value e
- Php::GLOBALS["e"] = Php::GLOBALS["e"][0]("hello");
-
- // if a global variable holds a function, we can call it
- return Php::GLOBALS["d"](1,2,3);
- }
-
-
-
-/**
- * End of namespace
- */
-}
-
diff --git a/tests/cpp/include/variables/002-get_complex_array.h b/tests/cpp/include/variables/002-get_complex_array.h
deleted file mode 100644
index b12e5ee..0000000
--- a/tests/cpp/include/variables/002-get_complex_array.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- *
- * Test variables
- * 002-get_complex_array.phpt
- *
- */
-
-
-
-
-/**
- * Set up namespace
- */
-namespace TestVariables {
-
- /**
- * This function returns complex array
- */
- Php::Value get_complex_array()
- {
- Php::Value r;
- r["a"] = 123;
- r["b"] = 456;
- r["c"][0] = "nested value";
- r["c"][1] = "example";
- r["c"][2] = 7;
- return r;
- }
-
-
-/**
- * End of namespace
- */
-}
-
diff --git a/tests/cpp/include/variables/003-value-types.h b/tests/cpp/include/variables/003-value-types.h
deleted file mode 100644
index d24549b..0000000
--- a/tests/cpp/include/variables/003-value-types.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- * Test variables
- * 003-value-types.phpt
- *
- */
-
-namespace TestVariables {
-
- /*
- * Check type of value
- * @param array
- */
- void value_types(Php::Parameters &params)
- {
- if (params.size() == 0) return;
- Php::Value arr = params[0];
-
- Php::out << "Null: " << bool2str( arr.get("Null").isNull() ) << std::endl;
- Php::out << "Numeric: " << bool2str( arr.get("Numeric").isNumeric()) << std::endl;
- Php::out << "Float: " << bool2str( arr.get("Float").isFloat() ) << std::endl;
- Php::out << "Bool: " << bool2str( arr.get("Bool").isBool() ) << std::endl;
- Php::out << "Array: " << bool2str( arr.get("Array").isArray() ) << std::endl;
- Php::out << "Object: " << bool2str( arr.get("Object").isObject() ) << std::endl;
- Php::out << "String: " << bool2str( arr.get("String").isString() ) << std::endl;
- Php::out << "Resource: " << bool2str( arr.get("Resource").type() == Php::Type::Resource ) << std::endl;
- Php::out << "Constant: " << bool2str( arr.get("Constant").type() == Php::Type::Constant ) << std::endl;
- Php::out << "ConstantArray: " << bool2str( arr.get("ConstantArray").type() == Php::Type::ConstantArray ) << std::endl;
- Php::out << "Callable1: " << bool2str( arr.get("Callable1").isCallable() ) << std::endl;
- Php::out << "Callable2: " << bool2str( arr.get("Callable2").isCallable() ) << std::endl;
- Php::out << "Callable3: " << bool2str( arr.get("Callable3").isCallable() ) << std::endl;
- Php::out << "Callable4: " << bool2str( arr.get("Callable4").isCallable() ) << std::endl;
-
- }
-
-}
-
diff --git a/tests/cpp/include/variables/004-store-scalar-variables.h b/tests/cpp/include/variables/004-store-scalar-variables.h
deleted file mode 100644
index 9ce82e5..0000000
--- a/tests/cpp/include/variables/004-store-scalar-variables.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- *
- * Test variables
- * 004-store-scalar-variables.phpt
- *
- */
-
-/**
- * Set up namespace
- */
-namespace TestVariables {
-
- /*
- * Test variables defined in PHP-CPP
- */
- Php::Value scalar_store(void) {
-
- Php::Value value1 = 1234;
- Php::Value value2 = "this is a string";
- Php::Value value3 = std::string("another string");
- Php::Value value4 = nullptr;
- Php::Value value5 = 123.45;
- Php::Value value6 = true;
-
- Php::Value r;
- r[0] = value1;
- r[1] = value2;
- r[2] = value3;
- r[3] = value4;
- r[4] = value5;
- r[5] = value6;
-
- r[6] = 1234;
- r[7] = "this is a string";
- r[8] = std::string("another string");
- r[9] = nullptr;
- r[10] = Php::Value();
- r[11] = 123.45;
- r[12] = false;
-
- return r;
- }
-
-/**
- * End of namespace
- */
-}
-
diff --git a/tests/cpp/include/variables/005-cast-objects-to-scalars.h b/tests/cpp/include/variables/005-cast-objects-to-scalars.h
deleted file mode 100644
index f053c4d..0000000
--- a/tests/cpp/include/variables/005-cast-objects-to-scalars.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- *
- * Test variables
- * 005-cast-objects-to-scalars.phpt
- *
- */
-
-
-
-/**
- * Set up namespace
- */
-namespace TestVariables {
-
- /**
- * A sample class, with methods to cast objects to scalars
- */
- class Obj2Scalar : public Php::Base
- {
- public:
- /**
- * C++ constructor and C++ destructpr
- */
- Obj2Scalar() {}
- virtual ~Obj2Scalar() {}
-
- /**
- * Cast to a string
- *
- * Note that now we use const char* as return value, and not Php::Value.
- * The __toString function is detected at compile time, and it does
- * not have a fixed signature. You can return any value that can be picked
- * up by a Php::Value object.
- *
- * @return const char *
- */
- const char *__toString()
- {
- return "Mount Meru, also called Sumeru (Sanskrit)";
- }
-
- /**
- * Cast to a integer
- * @return long
- */
- long __toInteger()
- {
- return 27032014;
- }
-
- /**
- * Cast to a floating point number
- * @return double
- */
- double __toFloat()
- {
- return 3.14159265359;
- }
-
- /**
- * Cast to a boolean
- * @return bool
- */
- bool __toBool()
- {
- return true;
- }
- };
-
-
-/**
- * End of namespace
- */
-}
-
diff --git a/tests/cpp/include/variables/006-casting-obj2str.h b/tests/cpp/include/variables/006-casting-obj2str.h
deleted file mode 100644
index 879683d..0000000
--- a/tests/cpp/include/variables/006-casting-obj2str.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- *
- * Test variables
- * 006-casting-obj2str.phpt
- *
- */
-
-
-
-/**
- * Set up namespace
- */
-namespace TestVariables {
-
-
- /*
- * Test Php::Value casting operators
- */
- void value_cast2str(Php::Parameters &params)
- {
- std::string value = params[0];
- Php::out << value << std::endl;
- }
-
-
-/**
- * End of namespace
- */
-}
-
diff --git a/tests/cpp/include/variables/007-overloaded-operators.h b/tests/cpp/include/variables/007-overloaded-operators.h
deleted file mode 100644
index 88b3117..0000000
--- a/tests/cpp/include/variables/007-overloaded-operators.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- *
- * Test variables
- * 007-overloaded-operators.phpt
- *
- */
-
-
-
-namespace TestVariables {
-
- /*
- * Test Php::Value overloaded operators
- */
- void overloaded_op(Php::Parameters &params)
- {
- Php::Value value = params[0];
- if (value == "some string")
- {
- Php::out << "value == 'some string'" << std::endl;
- }
-
- if (value == 12)
- {
- Php::out << "value == 12" << std::endl;
- }
- else if (value > 100)
- {
- Php::out << "value > 100" << std::endl;
- }
-
- value += 10;
- Php::out << value << std::endl;
-
- int r1 = value - 8;
- Php::out << r1 << std::endl;
-
- double r2 = value*123.45;
- Php::out << r2 << std::endl;
-
- double r3 = value/123.45;
- Php::out << r3 << std::endl;
- }
-
-}
-
diff --git a/tests/cpp/include/variables/008-value-arrays.h b/tests/cpp/include/variables/008-value-arrays.h
deleted file mode 100644
index 937f79a..0000000
--- a/tests/cpp/include/variables/008-value-arrays.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- *
- * Test variables
- * 008-value-arrays.phpt
- *
- */
-
-
-namespace TestVariables {
-
-
- /*
- * Test Php::Value arrays
- */
- Php::Value value_arrays(void)
- {
- // create a regular array
- Php::Value array;
- array[0] = "apple";
- array[1] = "banana";
- array[2] = "tomato";
-
- // an initializer list can be used to create a filled array
- Php::Value filled({ "a", "b", "c", "d"});
-
- // create an associative array
- Php::Value assoc;
- assoc["apple"] = "green";
- assoc["banana"] = "yellow";
- assoc["tomato"] = "green";
-
- // the variables in an array do not all have to be of the same type
- Php::Value assoc2;
- assoc2["x"] = "info@example.com";
- assoc2["y"] = nullptr;
- assoc2["z"] = 123;
-
- // nested arrays are possible too
- Php::Value assoc3;
- assoc3["x"] = "info@example.com";
- assoc3["y"] = nullptr;
- assoc3["z"][0] = "a";
- assoc3["z"][1] = "b";
- assoc3["z"][2] = "c";
-
- Php::Value r;
- r["array"] = array;
- r["filled"] = filled;
- r["assoc"] = assoc;
- r["assoc2"] = assoc2;
- r["assoc3"] = assoc3;
- return r;
- }
-
-
-}
-
diff --git a/tests/cpp/include/variables/009-010-value-object.h b/tests/cpp/include/variables/009-010-value-object.h
deleted file mode 100644
index e3eba85..0000000
--- a/tests/cpp/include/variables/009-010-value-object.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- *
- * Test variables
- * 009-value-object.phpt
- * 010-value-object2.phpt
- *
- */
-
-
-/**
- * Set up namespace
- */
-namespace TestVariables {
-
-
- /*
- * Test Php::Value object
- */
- Php::Value value_object1(void)
- {
-
- // create empty object of type stdClass
- Php::Object object;
-
- // object properties can be accessed with square brackets
- object["property1"] = "value1";
- object["property2"] = "value2";
-
- // Php::Value is the base class, so you can assign Php::Object objects
- //Php::Value value = object;
-
- return object;
- }
-
- /*
- * Test Php::Value object
- */
- Php::Value value_object2(void)
- {
-
- // create empty object of type stdClass
- Php::Object object;
-
- // to create an object of a different type, pass in the class name
- // to the constructor with optional constructor parameters
- //object = Php::Object("DateTime", "2014-03-27 00:37:15.638276");
-
- auto timeZone = Php::Object("DateTimeZone", "Europe/Amsterdam");
- object = Php::Object("DateTime", "2014-03-27 00:37:15", timeZone);
-
-
- // methods can be called with the call() method
- Php::out << object.call("format", "Y-m-d H:i:s") << std::endl;
-
- // all these methods can be called on a Php::Value object too
- Php::Value value = Php::Object("DateTime", "2016-03-31 15:48:00", timeZone);
- Php::out << value.call("format", "Y-m-d H:i:s") << std::endl;
- Php::out << value.call("getOffset") << std::endl;
-
- return object;
- }
-
-
-/**
- * End of namespace
- */
-}
-
diff --git a/tests/cpp/include/variables/011-012-value-casting-operators.h b/tests/cpp/include/variables/011-012-value-casting-operators.h
deleted file mode 100644
index 2d791b2..0000000
--- a/tests/cpp/include/variables/011-012-value-casting-operators.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- *
- * Test variables
- * 011-value-casting-operators.phpt
- * 012-value-casting-operators-double.phpt
- *
- */
-
-
-
-/**
- * Set up namespace
- */
-namespace TestVariables {
-
- /*
- * Test Php::Value casting operators
- */
- void value_casting(Php::Parameters &params)
- {
- Php::Value value = params[0];
-
- int64_t value1 = value;
- std::string value2 = value;
- bool value4 = value;
-
- Php::out << " long:" << value1 << "\n string:" << value2 << "\n bool:" << bool2str(value4) << std::endl;
- }
-
-
- /*
- * Test Php::Value casting operators
- */
- void value_cast2double(Php::Parameters &params)
- {
- Php::Value value = params[0];
- double value3 = value;
-
- /*
- * The remark (from valmat).
- * Somehow std::to_string truncates the tail of numbers of type `double` when converting it to a string.
- * So I wrote my own function `double2str()`, which does not have this drawback.
- */
- Php::out << double2str(value3) << std::endl;
- }
-
-
-/**
- * End of namespace
- */
-}
-
diff --git a/tests/cpp/include/variables/013-018-calling-php-functions.h b/tests/cpp/include/variables/013-018-calling-php-functions.h
deleted file mode 100644
index 9a77408..0000000
--- a/tests/cpp/include/variables/013-018-calling-php-functions.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/**
- *
- * Test call function
- * 013-calling-php-functions.phpt
- * ...
- * 018-calling-php-functions.phpt
- *
- */
-
-
-/**
- * Set up namespace
- */
-namespace TestVariables {
-
-
- /*
- * Test call function from user space
- */
- void fnFromUserSpace(void)
- {
-
-
- Php::out << "fnFromUserSpace" << std::endl;
-
- Php::Value param5;
- param5.set(0, "param5");
- param5.set(1, 3.14159265359);
- param5.set(2, 28032014);
- param5.set("key", "value");
-
- auto timeZone = Php::Object("DateTimeZone", "Asia/Yekaterinburg");
- Php::Value param6 = Php::Object("DateTime", "2014-03-28 19:42:15", timeZone);
-
- // call a function from user space
- Php::call("some_function", "param1");
- Php::call("some_function", "param1", "param2");
- Php::call("some_function", "param1", "param2", "param3");
- Php::call("some_function", "param1", "param2", "param3", "param4");
- Php::call("some_function", "param1", "param2", "param3", "param4", param5);
- Php::call("some_function", "param1", "param2", "param3", "param4", param5, param6);
- Php::call("some_function", "param1", "param2", "param3", "param4", "param5", "param6", "param7");
- Php::call("some_function", "param1", "param2", "param3", "param4", "param5", "param6", "param7", "param8");
- Php::call("some_function", "param1", "param2", "param3", "param4", "param5", "param6", "param7", "param8", "param9");
- Php::call("some_function", "param1", "param2", "param3", "param4", "param5", "param6", "param7", "param8", "param9", "param10");
-
- }
-
- /*
- * Test call callback
- */
- void fnCallback(Php::Parameters &params)
- {
- Php::out << "call callback" << std::endl;
-
- Php::Value callback = params[0];
-
-
- Php::Value param5;
- param5.set(0, "param5");
- param5.set(1, 3.14159265359);
- param5.set(2, 28032014);
- param5.set("key", "value");
-
- auto timeZone = Php::Object("DateTimeZone", "Asia/Yekaterinburg");
- Php::Value param6 = Php::Object("DateTime", "2014-03-28 19:42:15", timeZone);
-
- // call a function from user space
- callback("param1");
- callback("param1", "param2");
- callback("param1", "param2", "param3");
- callback("param1", "param2", "param3", "param4");
- callback("param1", "param2", "param3", "param4", param5);
- callback("param1", "param2", "param3", "param4", param5, param6);
- callback("param1", "param2", "param3", "param4", "param5", "param6", "param7");
- callback("param1", "param2", "param3", "param4", "param5", "param6", "param7", "param8");
- callback("param1", "param2", "param3", "param4", "param5", "param6", "param7", "param8", "param9");
- callback("param1", "param2", "param3", "param4", "param5", "param6", "param7", "param8", "param9", "param10");
-
- }
-
- /*
- * Test
- */
- void fnFromUserSpace2(void)
- {
-
- // create an object (this will also call __construct())
- Php::Object time("DateTime", "2014-03-28 21:22:15", Php::Object("DateTimeZone", "Asia/Irkutsk"));
-
- // call a method on the datetime object
- Php::out << time.call("format", "Y-m-d H:i:s") << std::endl;
-
- // in PHP it is possible to create an array with two parameters, the first
- // parameter being an object, and the second parameter should be the name
- // of the method, we can do that in PHP-CPP too
- Php::Array time_format({time, "format"});
-
- // call the method that is stored in the array
- Php::out << time_format("Y-m-d H:i:s") << std::endl;
-
- // call method of class from user space
- Php::Object usrspcl("usrspClass", "Mount Meru");
- Php::Array usrspcl_meth({usrspcl, "someMethod"});
- // call the method that is stored in the array
- Php::out << usrspcl_meth("is in the Arctics") << std::endl;
-
- // call callable object of class from user space
- Php::Object clbl("CallableClass", "Arctics around mount Meru");
- Php::out << clbl("is the birthplace of the Hyperboreans") << std::endl;
- }
-
-/**
- * End of namespace
- */
-}
-
diff --git a/tests/cpp/include/variables/019-HashMember-1.h b/tests/cpp/include/variables/019-HashMember-1.h
deleted file mode 100644
index 28003f0..0000000
--- a/tests/cpp/include/variables/019-HashMember-1.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * Test variables
- * 019-HashMember-1.phpt
- * Test HashMember
- *
- */
-
-
-
-
-/**
- * Set up namespace
- */
-namespace TestVariables {
-
- /**
- * This function returns complex array
- */
- Php::Value test_HashMember_1()
- {
- Php::Value r, tmp(Php::Type::Array);
- r["key1"] = tmp;
- r["key1"]["key2"] = "val2";
- r["key1"]["key3"] = "val3";
- return r;
- }
-
-/**
- * End of namespace
- */
-}
-
diff --git a/tests/cpp/include/variables/020-HashMember-2.h b/tests/cpp/include/variables/020-HashMember-2.h
deleted file mode 100644
index dfa95c2..0000000
--- a/tests/cpp/include/variables/020-HashMember-2.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- *
- * Test variables
- * 019-HashMember-2.phpt
- * Test HashMember
- *
- */
-
-
-
-
-/**
- * Set up namespace
- */
-namespace TestVariables {
-
- /**
- * This function returns complex array
- */
- Php::Value test_HashMember_2()
- {
- Php::Value r, empty_array(Php::Type::Array);
- r["k1"]["k3"] = "v1";
- r["k1"]["k2"]["k4"] = "v2";
- r["k5"][1] = "v3";
- r[2]["k6"][1] = "v4";
- r[3][4][1] = "v5";
- r[3][4][2][5][7][11] = "v5";
- r[3][4][2][5][7]["k"] = "v5";
- r["c"][0] = "nested value";
- r["c"][1] = nullptr;
- r["c"][2] = empty_array;
- r["c"][3] = "example";
- return r;
- }
-
-/**
- * End of namespace
- */
-}
-
diff --git a/tests/cpp/include/variables/021-HashMember-3.h b/tests/cpp/include/variables/021-HashMember-3.h
deleted file mode 100644
index f7c0914..0000000
--- a/tests/cpp/include/variables/021-HashMember-3.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- *
- * Test variables
- * 019-HashMember-3.phpt
- * Test HashMember
- *
- */
-
-
-
-
-/**
- * Set up namespace
- */
-namespace TestVariables {
-
- /**
- * This function returns complex array
- */
- Php::Value test_HashMember_3()
- {
-
- Php::Value r, tmp(Php::Type::Array);
- //Php::Value tmp;
-
- tmp.set("key2", "val1-2");
- r.set("key1", tmp);
- r.get("key1").set("key3", "val1-3");
-
- // expect to receive the same as when recording:
- //r["key1"]["key2"] = "val1-2";
- //r["key1"]["key3"] = "val1-3";
-
- return r;
- }
-
-/**
- * End of namespace
- */
-}
-
diff --git a/tests/cpp/include/variables/022-HashMember-4.h b/tests/cpp/include/variables/022-HashMember-4.h
deleted file mode 100644
index e51eb3a..0000000
--- a/tests/cpp/include/variables/022-HashMember-4.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- *
- * Test variables
- * 019-HashMember-4.phpt
- * Test HashMember
- *
- */
-
-
-
-
-/**
- * Set up namespace
- */
-namespace TestVariables {
-
- /**
- * This function returns complex array
- */
- Php::Value test_HashMember_4()
- {
-
-
- Php::Value r1;
- Php::Value tmp1,tmp2;
- tmp2.set("key3", "val");
- tmp1.set("key2", tmp2);
- r1.set("key1", tmp1);
- // this should be equivalent to:
- // r1["key1"]["key2"]["key3"] = "val";
-
- Php::Value r2;
- r2.set("str1", "example");
- r2.set("str2", r2.get("str1"));
- // this should be equivalent to:
- // r2["str1"] = "example";
- // r2["str2"] = r2["str1"];
- // i.e.
- // r2["str1"] = "example";
- // r2["str2"] = "example";
-
- Php::Value r3;
- Php::Value tmp;
- tmp.set("str2", "val1-2");
- tmp.set("str3", "val1-3");
- r3.set("str1", tmp);
- // this should be equivalent to:
- // r3["str1"]["str2"] = "val1-2";
- // r3["str1"]["str3"] = "val1-3";
-
-
- Php::Value r;
- r[0] = r1;
- r[1] = r2;
- r[2] = r3;
-
-
- return r;
- }
-
-/**
- * End of namespace
- */
-}
-
diff --git a/tests/cpp/include/variables/023-cookie.h b/tests/cpp/include/variables/023-cookie.h
deleted file mode 100644
index 6f74883..0000000
--- a/tests/cpp/include/variables/023-cookie.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- *
- * Test superglobal variables _COOKIE
- * 023-cookie.phpt
- *
- */
-
-
-
-
-/**
- * Set up namespace
- */
-namespace TestVariables {
-
-
- /*
- * Test
- */
- void getCookie(void)
- {
- Php::out << "_COOKIE[peace] = " << Php::COOKIE["peace"] << std::endl;
- Php::out << "_COOKIE[freedom] = " << Php::COOKIE["freedom"] << std::endl;
- Php::out << "_COOKIE[empty] = " << Php::COOKIE["empty"] << std::endl;
- }
-
-/**
- * End of namespace
- */
-}
-
diff --git a/tests/cpp/include/variables/024-get-post.h b/tests/cpp/include/variables/024-get-post.h
deleted file mode 100644
index e615f0f..0000000
--- a/tests/cpp/include/variables/024-get-post.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- *
- * Test superglobal variables _GET & _POST
- * 024-get-post.phpt
- *
- */
-
-
-
-
-/**
- * Set up namespace
- */
-namespace TestVariables {
-
-
- /*
- * Test
- */
- void get_post(void)
- {
- Php::out << "_GET[a] = " << Php::GET["a"] << std::endl;
- Php::out << "_GET[b] = " << Php::GET["b"] << std::endl;
- Php::out << "_GET[ar][elm1] = " << Php::GET["ar"]["elm1"] << std::endl;
- Php::out << "_GET[ar][elm2] = " << Php::GET["ar"]["elm2"] << std::endl;
-
- Php::out << "_POST[c] = " << Php::POST["c"] << std::endl;
- Php::out << "_POST[d] = " << Php::POST["d"] << std::endl;
- Php::out << "_POST[e] = " << Php::POST["e"] << std::endl;
- Php::out << "_POST[e][0] = " << Php::POST["e"][0] << std::endl;
- Php::out << "_POST[e][1] = " << Php::POST["e"][1] << std::endl;
- }
-
-/**
- * End of namespace
- */
-}
-
diff --git a/tests/cpp/include/variables/025-post-raw1.h b/tests/cpp/include/variables/025-post-raw1.h
deleted file mode 100644
index 37c6ae1..0000000
--- a/tests/cpp/include/variables/025-post-raw1.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- *
- * Test superglobal variables _POST
- * 025-post-raw1.phpt
- *
- */
-
-
-
-
-/**
- * Set up namespace
- */
-namespace TestVariables {
- using namespace Php;
-
-
- /*
- * Test
- */
- void post_raw1(void)
- {
- out << "username => "<< POST["username"] << std::endl;
- out << "text => "<< POST["text"] << std::endl;
-
- /*
- XXX TODO: conversion from ‘Php::Super’ to ‘Php::Value‘
- Value v = POST;
-
- out << "Array/Object contains " << v.size() << " items" << std::endl;
- for (auto it=v.begin(), itend = v.end(); it != itend; ++it) {
- out << "["<< it->first << "]="<< it->second << std::endl;
- }
- */
- }
-
-/**
- * End of namespace
- */
-}
-
diff --git a/tests/cpp/include/variables/026-post-raw2.h b/tests/cpp/include/variables/026-post-raw2.h
deleted file mode 100644
index d250dc8..0000000
--- a/tests/cpp/include/variables/026-post-raw2.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- *
- * Test superglobal variables _POST
- * 026-post-raw2.phpt
- *
- */
-
-
-#include <iostream>
-#include <fstream>
-
-/**
- * Set up namespace
- */
-namespace TestVariables {
- using namespace Php;
-
-
- /*
- * Test
- */
- void post_raw2(void)
- {
- out << "name1 : "<< FILES["flnm"]["name"][0] << std::endl;
- out << "name2 : "<< FILES["flnm"]["name"][1] << std::endl;
-
- out << "type1 : "<< FILES["flnm"]["type"][0] << std::endl;
- out << "type2 : "<< FILES["flnm"]["type"][1] << std::endl;
-
- out << "error1 : "<< FILES["flnm"]["error"][0] << std::endl;
- out << "error2 : "<< FILES["flnm"]["error"][1] << std::endl;
-
- out << "size1 : "<< FILES["flnm"]["size"][0] << std::endl;
- out << "size2 : "<< FILES["flnm"]["size"][1] << std::endl;
-
-
- int length0 = FILES["flnm"]["size"][0];
- int length1 = FILES["flnm"]["size"][1];
- char *buffer0, *buffer1;
-
- std::ifstream file0, file1;
- std::string filename0 = FILES["flnm"]["tmp_name"][0];
- std::string filename1 = FILES["flnm"]["tmp_name"][1];
-
- file0.open(filename0, std::ios::in | std::ios::binary);
- file1.open(filename1, std::ios::in | std::ios::binary);
-
- if(!file0.is_open() || !file1.is_open()) {
- out << "Cannot open file." << std::endl;
- return;
- }
-
- //allocate memory
- buffer0 = new char[length0];
- buffer1 = new char[length1];
-
- //read data as a block to buffer
- file0.read(buffer0, length0);
- file1.read(buffer1, length1);
- file0.close();
- file1.close();
-
- out << "content1 : ";
- out.write(buffer0, length0);
- out << std::endl;
- out << "content2 : "<< buffer1 << std::endl;
-
- delete[] buffer0;
- delete[] buffer1;
- }
-
-/**
- * End of namespace
- */
-}
-
diff --git a/tests/cpp/include/variables/027-env.h b/tests/cpp/include/variables/027-env.h
deleted file mode 100644
index b8455b4..0000000
--- a/tests/cpp/include/variables/027-env.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- *
- * Test superglobal variables _ENV
- * 027-env.phpt
- *
- */
-
-
-
-namespace TestVariables {
-
-
- /*
- * Test
- */
- void test_env(void)
- {
- Php::out << "HTTP_USER_AGENT => " << Php::SERVER["HTTP_USER_AGENT"] << std::endl;
- Php::out << "ENVVAR1 => " << Php::SERVER["ENVVAR1"] << std::endl;
- Php::out << "HTTP_REFERER => " << Php::SERVER["HTTP_REFERER"] << std::endl;
- Php::out << "REQUEST_METHOD => " << Php::SERVER["REQUEST_METHOD"] << std::endl;
- Php::out << "HTTP_HOST => " << Php::SERVER["HTTP_HOST"] << std::endl;
- }
-
-}
-
diff --git a/tests/cpp/include/variables/028-029-compare.h b/tests/cpp/include/variables/028-029-compare.h
deleted file mode 100644
index bd95298..0000000
--- a/tests/cpp/include/variables/028-029-compare.h
+++ /dev/null
@@ -1,194 +0,0 @@
-/**
- *
- * Test variables
- * phptname.phpt
- *
- */
-
-
-
-
-/**
- * Set up namespace
- */
-namespace TestVariables {
-
- /*
- * Test bool Value::operator==(const Value &value) const
- */
- void test_compare1()
- {
- Php::Value v1(5), v2(5.0), v3("5"), v4("5.0");
-
- Php::out << "true:" << std::endl;
- Php::out << (v1 == v2) << std::endl;
- Php::out << (v1 == v3) << std::endl;
- Php::out << (v1 == v4) << std::endl;
- Php::out << (v2 == v1) << std::endl;
- Php::out << (v2 == v3) << std::endl;
- Php::out << (v2 == v4) << std::endl;
- Php::out << (v3 == v1) << std::endl;
- Php::out << (v3 == v2) << std::endl;
- Php::out << (v3 == v4) << std::endl;
- Php::out << (v4 == v1) << std::endl;
- Php::out << (v4 == v2) << std::endl;
- Php::out << (v4 == v3) << std::endl;
-
- Php::Value v5(6), v6(6.0), v7("6"), v8("6.0");
-
- Php::out << "false:" << std::endl;
- Php::out << (v1 == v5) << std::endl;
- Php::out << (v1 == v6) << std::endl;
- Php::out << (v1 == v7) << std::endl;
- Php::out << (v1 == v8) << std::endl;
-
- Php::out << (v2 == v5) << std::endl;
- Php::out << (v2 == v6) << std::endl;
- Php::out << (v2 == v7) << std::endl;
- Php::out << (v2 == v8) << std::endl;
-
- Php::out << (v3 == v5) << std::endl;
- Php::out << (v3 == v6) << std::endl;
- Php::out << (v3 == v7) << std::endl;
- Php::out << (v3 == v8) << std::endl;
-
- Php::out << (v4 == v5) << std::endl;
- Php::out << (v4 == v6) << std::endl;
- Php::out << (v4 == v7) << std::endl;
- Php::out << (v4 == v8) << std::endl;
-
- Php::Value v9, v10, v11, v12;
- v9[0] = 5;
- v9[1] = 6;
-
- v10[0] = 5;
- v10[1] = "Hello!";
-
- v11[0] = 5;
- v11[1] = 6;
-
- v12[0] = 5;
-
- Php::out << "Compare array:" << std::endl;
- Php::out << (v1 == v9) << std::endl;
- Php::out << (v5 == v9) << std::endl;
- Php::out << (v9 == v10) << std::endl;
- Php::out << (v11 == v9) << std::endl;
- Php::out << (v12 == v9) << std::endl;
-
- Php::Value v13 = false, v14, v15 = 0;
- Php::out << "Compare NULL:" << std::endl;
- Php::out << (v1 == v13) << std::endl;
- Php::out << (v1 == v14) << std::endl;
- Php::out << (v1 == v15) << std::endl;
-
- Php::out << (v13 == v14) << std::endl;
- Php::out << (v13 == v15) << std::endl;
- Php::out << (v14 == v15) << std::endl;
- }
-
- /*
- * Test bool Value::operator< (const Value &value) const
- */
- void test_compare2()
- {
- Php::Value v1(5), v2(5.0), v3("5"), v4("5.0");
-
- Php::out << "false:" << std::endl;
- Php::out << (v1 < v2) << std::endl;
- Php::out << (v1 < v3) << std::endl;
- Php::out << (v1 < v4) << std::endl;
- Php::out << (v2 < v1) << std::endl;
- Php::out << (v2 < v3) << std::endl;
- Php::out << (v2 < v4) << std::endl;
- Php::out << (v3 < v1) << std::endl;
- Php::out << (v3 < v2) << std::endl;
- Php::out << (v3 < v4) << std::endl;
- Php::out << (v4 < v1) << std::endl;
- Php::out << (v4 < v2) << std::endl;
- Php::out << (v4 < v3) << std::endl;
-
- Php::Value v5(6), v6(6.0), v7("6"), v8("6.0");
-
- Php::out << "true:" << std::endl;
- Php::out << (v1 < v5) << std::endl;
- Php::out << (v1 < v6) << std::endl;
- Php::out << (v1 < v7) << std::endl;
- Php::out << (v1 < v8) << std::endl;
-
- Php::out << (v2 < v5) << std::endl;
- Php::out << (v2 < v6) << std::endl;
- Php::out << (v2 < v7) << std::endl;
- Php::out << (v2 < v8) << std::endl;
-
- Php::out << (v3 < v5) << std::endl;
- Php::out << (v3 < v6) << std::endl;
- Php::out << (v3 < v7) << std::endl;
- Php::out << (v3 < v8) << std::endl;
-
- Php::out << (v4 < v5) << std::endl;
- Php::out << (v4 < v6) << std::endl;
- Php::out << (v4 < v7) << std::endl;
- Php::out << (v4 < v8) << std::endl;
-
- Php::out << "false:" << std::endl;
- Php::out << (v1 > v5) << std::endl;
- Php::out << (v1 > v6) << std::endl;
- Php::out << (v1 > v7) << std::endl;
- Php::out << (v1 > v8) << std::endl;
-
- Php::out << (v2 > v5) << std::endl;
- Php::out << (v2 > v6) << std::endl;
- Php::out << (v2 > v7) << std::endl;
- Php::out << (v2 > v8) << std::endl;
-
- Php::out << (v3 > v5) << std::endl;
- Php::out << (v3 > v6) << std::endl;
- Php::out << (v3 > v7) << std::endl;
- Php::out << (v3 > v8) << std::endl;
-
- Php::out << (v4 > v5) << std::endl;
- Php::out << (v4 > v6) << std::endl;
- Php::out << (v4 > v7) << std::endl;
- Php::out << (v4 > v8) << std::endl;
-
- Php::Value v9, v10, v11, v12;
- v9[0] = 5;
- v9[1] = 6;
-
- v10[0] = 5;
- v10[1] = "Hello!";
-
- v11[0] = 5;
- v11[1] = 6;
-
- v12[0] = 5;
-
- Php::out << "Compare array:" << std::endl;
- Php::out << (v1 < v9) << std::endl;
- Php::out << (v5 < v9) << std::endl;
- Php::out << (v9 < v10) << std::endl;
- Php::out << (v9 > v10) << std::endl;
- Php::out << (v11 < v9) << std::endl;
- Php::out << (v12 < v9) << std::endl;
-
- Php::Value v13 = false, v14, v15 = 0;
- Php::out << "Compare NULL:" << std::endl;
- Php::out << (v1 < v13) << std::endl;
- Php::out << (v1 < v14) << std::endl;
- Php::out << (v1 < v15) << std::endl;
-
- Php::out << (v1 > v13) << std::endl;
- Php::out << (v1 > v14) << std::endl;
- Php::out << (v1 > v15) << std::endl;
-
- Php::out << (v13 < v14) << std::endl;
- Php::out << (v13 < v15) << std::endl;
- Php::out << (v14 < v15) << std::endl;
- }
-
-/**
- * End of namespace
- */
-}
-
diff --git a/tests/cpp/include/variables/tpl.h b/tests/cpp/include/variables/tpl.h
deleted file mode 100644
index 0df5892..0000000
--- a/tests/cpp/include/variables/tpl.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- *
- * Test variables
- * phptname.phpt
- *
- */
-
-
-
-
-/**
- * Set up namespace
- */
-namespace TestVariables {
-
- /*
- * Test
- */
- void fnname(Php::Parameters &params)
- {
-
-
- }
-
-/**
- * End of namespace
- */
-}
-
diff --git a/tests/cpp/main.cpp b/tests/cpp/main.cpp
deleted file mode 100644
index 47cd90d..0000000
--- a/tests/cpp/main.cpp
+++ /dev/null
@@ -1,179 +0,0 @@
-/**
- *
- * An example file to show the working of using a C++ class in PHP.
- */
-
-#include <string>
-#include <iostream>
-#include <phpcpp.h>
-
-// Test includes
-#include "h/ValueIterator.h"
-#include "h/Classes_and_objects.h"
-#include "h/variables.h"
-#include "h/ini_entries.h"
-
-
-
-
-// Symbols are exported according to the "C" language
-extern "C"
-{
- // export the "get_module" function that will be called by the Zend engine
- PHPCPP_EXPORT void *get_module()
- {
- // create extension
- static Php::Extension extension("extension_for_tests","0.1");
-
- // build an interface
- //Php::Interface interface("MyInterface");
-
- // add methods to the interface
- //interface.method("method1");
- //interface.method("method2");
-
- // add the interface to the extension
- //extension.add(interface);
-
-
-
-
- /**
- * Classes and objects
- *
- */
- // we are going to define a class
- Php::Class<TestBaseClass::MyCustomClass> customClass("TestBaseClass\\MyClass");
-
- // add methods to it
- customClass.method("myMethod", &TestBaseClass::MyCustomClass::myMethod, Php::Final, {});
- customClass.property("property1", "prop1");
- customClass.property("property2", "prop2", Php::Protected);
-
- customClass.property("CONSTANT1", "some string", Php::Const);
- customClass.property("EXP", 2.718281828459, Php::Const);
- customClass.property("CONSTANT2", -2582341, Php::Const);
- customClass.property("CONSTANT3", true, Php::Const);
-
- customClass.property("StatProp1", "some string", Php::Static);
- customClass.property("Exp", 2.718281828459, Php::Static);
- customClass.property("StatProp2", -2582341, Php::Static);
- customClass.property("StatProp3", true, Php::Static);
-
- // add the class to the extension
- extension.add(customClass);
-
- // Comparable
- extension.add( Php::Class<TestBaseClass::Comparable>("TestBaseClass\\Comparable") );
-
-
- // test static functions
- //
- // description of the class so that PHP knows which methods are accessible
- Php::Class<TestBaseClass::testStaticPubClass> ClassWithStatic("TestBaseClass\\ClassWithStatic");
- // register the testStaticPubClass::staticMethod to be a static method callable from PHP
- ClassWithStatic.method("static1", &TestBaseClass::testStaticPubClass::staticMethod);
- // regular functions have the same signatures as static methods. So nothing forbids you to register a normal function as static method too
- ClassWithStatic.method("static2", TestBaseClass::testStaticRegFunc);
- // and even static methods from completely different classes have the same function signature and can thus be registered
- ClassWithStatic.method("static3", &TestBaseClass::testStaticPrivClass::staticMethod);
- // add the class to the extension
- extension.add(std::move(ClassWithStatic));
- // In fact, because a static method has the same signature
- // as a regular function, you can also register static
- // C++ methods as regular global PHP functions
- extension.add("TestBaseClass\\staticFun1", &TestBaseClass::testStaticPrivClass::staticMethod);
-
-
-
-
- /**
- * tests for Iterators
- *
- */
- // add function to extension
- //extension.add("TestValueIterator\\loopValue", TestValueIterator::loopValue/*, {
- extension.add("TestValueIterator\\loopValue", TestValueIterator::loopValue);
- extension.add("TestValueIterator\\loopArray", TestValueIterator::loopArray);
-
-
- /**
- * tests for variables
- *
- */
- // create a nested namespace
- extension.add("TestVariables\\process_globals", TestVariables::process_globals);
- extension.add("TestVariables\\get_complex_array", TestVariables::get_complex_array);
- extension.add("TestVariables\\value_types", TestVariables::value_types);
- extension.add("TestVariables\\scalar_store", TestVariables::scalar_store);
- extension.add("TestVariables\\value_casting", TestVariables::value_casting);
- extension.add("TestVariables\\value_cast2double", TestVariables::value_cast2double);
- extension.add("TestVariables\\value_cast2str", TestVariables::value_cast2str);
- extension.add("TestVariables\\overloaded_op", TestVariables::overloaded_op);
- extension.add("TestVariables\\value_arrays", TestVariables::value_arrays);
- extension.add("TestVariables\\value_object1", TestVariables::value_object1);
- extension.add("TestVariables\\value_object2", TestVariables::value_object2);
- extension.add("TestVariables\\fnFromUserSpace", TestVariables::fnFromUserSpace);
- extension.add("TestVariables\\fnFromUserSpace2", TestVariables::fnFromUserSpace2);
- extension.add("TestVariables\\fnCallback", TestVariables::fnCallback);
- extension.add("TestVariables\\test_HashMember_1", TestVariables::test_HashMember_1);
- extension.add("TestVariables\\test_HashMember_2", TestVariables::test_HashMember_2);
- extension.add("TestVariables\\test_HashMember_3", TestVariables::test_HashMember_3);
- extension.add("TestVariables\\test_HashMember_4", TestVariables::test_HashMember_4);
- extension.add("TestVariables\\getCookie", TestVariables::getCookie);
- extension.add("TestVariables\\get_post", TestVariables::get_post);
- extension.add("TestVariables\\post_raw1", TestVariables::post_raw1);
- extension.add("TestVariables\\post_raw2", TestVariables::post_raw2);
- extension.add("TestVariables\\test_env", TestVariables::test_env);
- extension.add("TestVariables\\test_compare1", TestVariables::test_compare1);
- extension.add("TestVariables\\test_compare2", TestVariables::test_compare2);
-
-
-
-
-
- // A sample class, with methods to cast objects to scalars
- Php::Class<TestVariables::Obj2Scalar> cObj2Scalar("TestVariables\\Obj2Scalar");
- extension.add(std::move(cObj2Scalar));
-
-
- /**
- * tests ini entries
- *
- */
- extension
- .add(Php::Ini("ini1", "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));
-
- Php::Ini ini6("ini6", 55, 11);
- extension
- .add(ini6)
- .add(Php::Ini("ini7", 74,5));
-
- Php::Ini ini8("ini8", 3.1415926, 6.2831852);
- Php::Ini ini9("ini9", 2.7182818, 5.4365636, Php::Ini::User);
- //extension.add(Php::Ini("ini9", 0.333333, 0.777777, Php::Ini::Perdir));
-
- extension.add(ini8);
- extension.add(std::move(ini9));
-
- extension.add("TestIniEntries\\iniTest1", TestIniEntries::iniTest1);
-
- extension.onStartup([](){
- // Retrieve a value at boot extension
- TestIniEntries::ini6val = Php::ini_get("ini6");
- });
-
-
-
-
-
-
-
- // return the extension module
- return extension;
- }
-}
diff --git a/tests/cpp/readme b/tests/cpp/readme
deleted file mode 100644
index c3743ce..0000000
--- a/tests/cpp/readme
+++ /dev/null
@@ -1,2 +0,0 @@
-This extension is written with a single purpose - all tests will be conducted through it.
-No installation required!