Port TestExtClass to php; delete TestExtClosure through Continuation
Esse commit está contido em:
@@ -36,10 +36,6 @@
|
||||
#include "hphp/facebook/extensions/urlextraction/test_ext_urlextraction.h"
|
||||
#include "hphp/test/ext/test_ext_bcmath.h"
|
||||
#include "hphp/test/ext/test_ext_bzip2.h"
|
||||
#include "hphp/test/ext/test_ext_class.h"
|
||||
#include "hphp/test/ext/test_ext_closure.h"
|
||||
#include "hphp/test/ext/test_ext_collections.h"
|
||||
#include "hphp/test/ext/test_ext_continuation.h"
|
||||
#include "hphp/test/ext/test_ext_ctype.h"
|
||||
#include "hphp/test/ext/test_ext_curl.h"
|
||||
#include "hphp/test/ext/test_ext_datetime.h"
|
||||
|
||||
@@ -1,147 +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_class.h"
|
||||
#include "hphp/runtime/ext/ext_class.h"
|
||||
#include "hphp/runtime/ext/ext_array.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TestExtClass::RunTests(const std::string &which) {
|
||||
bool ret = true;
|
||||
|
||||
DECLARE_TEST_FUNCTIONS("class test implements itestable {"
|
||||
" public $foo;"
|
||||
" protected $prop;"
|
||||
" private $bar;"
|
||||
" public function foo() {}"
|
||||
" protected function func() {}"
|
||||
" function bar() {}"
|
||||
" const const_foo = 'f';"
|
||||
"}"
|
||||
"interface itestable {"
|
||||
" function foo();"
|
||||
" function bar();"
|
||||
"}"
|
||||
);
|
||||
|
||||
RUN_TEST(test_get_declared_classes);
|
||||
RUN_TEST(test_get_declared_interfaces);
|
||||
RUN_TEST(test_class_exists);
|
||||
RUN_TEST(test_interface_exists);
|
||||
RUN_TEST(test_get_class_methods);
|
||||
RUN_TEST(test_get_class_vars);
|
||||
RUN_TEST(test_get_class_constants);
|
||||
RUN_TEST(test_get_class);
|
||||
RUN_TEST(test_get_parent_class);
|
||||
RUN_TEST(test_is_a);
|
||||
RUN_TEST(test_is_subclass_of);
|
||||
RUN_TEST(test_method_exists);
|
||||
RUN_TEST(test_property_exists);
|
||||
RUN_TEST(test_get_object_vars);
|
||||
RUN_TEST(test_call_user_method_array);
|
||||
RUN_TEST(test_call_user_method);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// test classes are all in g_class_map defined in test_externals.cpp
|
||||
|
||||
bool TestExtClass::test_get_declared_classes() {
|
||||
Array classes = f_get_declared_classes();
|
||||
VS(f_in_array("test", classes, true), true);
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtClass::test_get_declared_interfaces() {
|
||||
Array classes = f_get_declared_interfaces();
|
||||
VS(f_in_array("itestable", classes, true), true);
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtClass::test_class_exists() {
|
||||
VERIFY(f_class_exists("TEst"));
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtClass::test_interface_exists() {
|
||||
VERIFY(f_interface_exists("iTESTable"));
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtClass::test_get_class_methods() {
|
||||
Array methods = f_get_class_methods("TEst");
|
||||
VS(methods[0], "foo");
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtClass::test_get_class_vars() {
|
||||
Array properties = f_get_class_vars("TEst");
|
||||
VS(properties, CREATE_MAP1("foo", uninit_null()));
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtClass::test_get_class_constants() {
|
||||
Array constants = f_get_class_constants("test");
|
||||
VS(constants, CREATE_MAP1("const_foo", "f"));
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtClass::test_get_class() {
|
||||
// TestCodeRun covers this
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtClass::test_get_parent_class() {
|
||||
// TestCodeRun covers this
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtClass::test_is_a() {
|
||||
// TestCodeRun covers this
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtClass::test_is_subclass_of() {
|
||||
// TestCodeRun covers this
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtClass::test_method_exists() {
|
||||
// TestCodeRun covers this
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtClass::test_property_exists() {
|
||||
VERIFY(f_property_exists("TEst", "prop"));
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtClass::test_get_object_vars() {
|
||||
// TestCodeRun covers this
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtClass::test_call_user_method_array() {
|
||||
// TestCodeRun covers this
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtClass::test_call_user_method() {
|
||||
// TestCodeRun covers this
|
||||
return Count(true);
|
||||
}
|
||||
@@ -1,50 +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_CLASS_H_
|
||||
#define incl_HPHP_TEST_EXT_CLASS_H_
|
||||
|
||||
// >>>>>> Generated by idl.php. Do NOT modify. <<<<<<
|
||||
|
||||
#include "hphp/test/ext/test_cpp_ext.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class TestExtClass : public TestCppExt {
|
||||
public:
|
||||
virtual bool RunTests(const std::string &which);
|
||||
|
||||
bool test_get_declared_classes();
|
||||
bool test_get_declared_interfaces();
|
||||
bool test_class_exists();
|
||||
bool test_interface_exists();
|
||||
bool test_get_class_methods();
|
||||
bool test_get_class_vars();
|
||||
bool test_get_class_constants();
|
||||
bool test_get_class();
|
||||
bool test_get_parent_class();
|
||||
bool test_is_a();
|
||||
bool test_is_subclass_of();
|
||||
bool test_method_exists();
|
||||
bool test_property_exists();
|
||||
bool test_get_object_vars();
|
||||
bool test_call_user_method_array();
|
||||
bool test_call_user_method();
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // incl_HPHP_TEST_EXT_CLASS_H_
|
||||
@@ -1,34 +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_closure.h"
|
||||
#include "hphp/runtime/ext/ext_closure.h"
|
||||
|
||||
IMPLEMENT_SEP_EXTENSION_TEST(Closure);
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TestExtClosure::RunTests(const std::string &which) {
|
||||
bool ret = true;
|
||||
|
||||
RUN_TEST(test_Closure);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TestExtClosure::test_Closure() {
|
||||
return Count(true);
|
||||
}
|
||||
@@ -1,35 +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_CLOSURE_H_
|
||||
#define incl_HPHP_TEST_EXT_CLOSURE_H_
|
||||
|
||||
// >>>>>> Generated by idl.php. Do NOT modify. <<<<<<
|
||||
|
||||
#include "hphp/test/ext/test_cpp_ext.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class TestExtClosure : public TestCppExt {
|
||||
public:
|
||||
virtual bool RunTests(const std::string &which);
|
||||
|
||||
bool test_Closure();
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // incl_HPHP_TEST_EXT_CLOSURE_H_
|
||||
@@ -1,30 +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_collections.h"
|
||||
#include "hphp/runtime/ext/ext_collections.h"
|
||||
|
||||
IMPLEMENT_SEP_EXTENSION_TEST(Collection);
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TestExtCollections::RunTests(const std::string &which) {
|
||||
bool ret = true;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -1,33 +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_COLLECTION_H_
|
||||
#define incl_HPHP_TEST_EXT_COLLECTION_H_
|
||||
|
||||
// >>>>>> Generated by idl.php. Do NOT modify. <<<<<<
|
||||
|
||||
#include "hphp/test/ext/test_cpp_ext.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class TestExtCollections : public TestCppExt {
|
||||
public:
|
||||
virtual bool RunTests(const std::string &which);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // incl_HPHP_TEST_EXT_COLLECTION_H_
|
||||
@@ -1,40 +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_continuation.h"
|
||||
#include "hphp/runtime/ext/ext_continuation.h"
|
||||
|
||||
IMPLEMENT_SEP_EXTENSION_TEST(Continuation);
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TestExtContinuation::RunTests(const std::string &which) {
|
||||
bool ret = true;
|
||||
|
||||
RUN_TEST(test_BaseContinuation);
|
||||
RUN_TEST(test_Continuation);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TestExtContinuation::test_BaseContinuation() {
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtContinuation::test_Continuation() {
|
||||
return Count(true);
|
||||
}
|
||||
@@ -1,36 +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_CONTINUATION_H_
|
||||
#define incl_HPHP_TEST_EXT_CONTINUATION_H_
|
||||
|
||||
// >>>>>> Generated by idl.php. Do NOT modify. <<<<<<
|
||||
|
||||
#include "hphp/test/ext/test_cpp_ext.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class TestExtContinuation : public TestCppExt {
|
||||
public:
|
||||
virtual bool RunTests(const std::string &which);
|
||||
|
||||
bool test_BaseContinuation();
|
||||
bool test_Continuation();
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // incl_HPHP_TEST_EXT_CONTINUATION_H_
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
class test implements itestable {
|
||||
public $foo;
|
||||
protected $prop;
|
||||
private $bar;
|
||||
public function foo() {}
|
||||
protected function func() {}
|
||||
function bar() {}
|
||||
const const_foo = 'f';
|
||||
}
|
||||
|
||||
interface itestable {
|
||||
function foo();
|
||||
function bar();
|
||||
}
|
||||
|
||||
$classes = get_declared_classes();
|
||||
var_dump(in_array("test", $classes, true));
|
||||
|
||||
$interfaces = get_declared_interfaces();
|
||||
var_dump(in_array("itestable", $interfaces, true));
|
||||
|
||||
var_dump(class_exists("TEst"));
|
||||
|
||||
var_dump(interface_exists("iTESTable"));
|
||||
|
||||
var_dump(get_class_methods("TEst")[0] === "foo");
|
||||
|
||||
var_dump(get_class_vars("TEst") === array("foo" => null));
|
||||
|
||||
var_dump(get_class_constants("test") === array("const_foo" => "f"));
|
||||
@@ -0,0 +1,7 @@
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
Referência em uma Nova Issue
Bloquear um usuário