Move TestExtXml{,Reader,Writer} to php
Esse commit está contido em:
@@ -71,9 +71,6 @@
|
||||
#include "hphp/test/ext/test_ext_string.h"
|
||||
#include "hphp/test/ext/test_ext_url.h"
|
||||
#include "hphp/test/ext/test_ext_variable.h"
|
||||
#include "hphp/test/ext/test_ext_xml.h"
|
||||
#include "hphp/test/ext/test_ext_xmlreader.h"
|
||||
#include "hphp/test/ext/test_ext_xmlwriter.h"
|
||||
#include "hphp/test/ext/test_ext_zlib.h"
|
||||
|
||||
#endif // incl_EXT_LIST_TEST_EXT_H_
|
||||
|
||||
@@ -1,190 +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_xml.h"
|
||||
#include "hphp/runtime/ext/ext_xml.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TestExtXml::RunTests(const std::string &which) {
|
||||
bool ret = true;
|
||||
|
||||
RUN_TEST(test_xml_parser_create);
|
||||
RUN_TEST(test_xml_parser_free);
|
||||
RUN_TEST(test_xml_parse);
|
||||
RUN_TEST(test_xml_parse_into_struct);
|
||||
RUN_TEST(test_xml_parser_create_ns);
|
||||
RUN_TEST(test_xml_parser_get_option);
|
||||
RUN_TEST(test_xml_parser_set_option);
|
||||
RUN_TEST(test_xml_set_character_data_handler);
|
||||
RUN_TEST(test_xml_set_default_handler);
|
||||
RUN_TEST(test_xml_set_element_handler);
|
||||
RUN_TEST(test_xml_set_processing_instruction_handler);
|
||||
RUN_TEST(test_xml_set_start_namespace_decl_handler);
|
||||
RUN_TEST(test_xml_set_end_namespace_decl_handler);
|
||||
RUN_TEST(test_xml_set_unparsed_entity_decl_handler);
|
||||
RUN_TEST(test_xml_set_external_entity_ref_handler);
|
||||
RUN_TEST(test_xml_set_notation_decl_handler);
|
||||
RUN_TEST(test_xml_set_object);
|
||||
RUN_TEST(test_xml_get_current_byte_index);
|
||||
RUN_TEST(test_xml_get_current_column_number);
|
||||
RUN_TEST(test_xml_get_current_line_number);
|
||||
RUN_TEST(test_xml_get_error_code);
|
||||
RUN_TEST(test_xml_error_string);
|
||||
RUN_TEST(test_utf8_decode);
|
||||
RUN_TEST(test_utf8_encode);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TestExtXml::test_xml_parser_create() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXml::test_xml_parser_free() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXml::test_xml_parse() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXml::test_xml_parse_into_struct() {
|
||||
//VCB("<?php ");
|
||||
String simple = "<para><note attrib1='foo'>simple&note</note></para>";
|
||||
Variant p = f_xml_parser_create();
|
||||
Variant vals, index;
|
||||
f_xml_parse_into_struct(p, simple, ref(vals), ref(index));
|
||||
f_xml_parser_free(p);
|
||||
VS(f_print_r(index.rvalAt(String("PARA")),1),
|
||||
"Array\n(\n [0] => 0\n [1] => 2\n)\n");
|
||||
VS(f_print_r(index.rvalAt(String("NOTE")),1),
|
||||
"Array\n(\n [0] => 1\n)\n");
|
||||
VS(f_print_r(vals.rvalAt(0),1),
|
||||
"Array\n(\n [tag] => PARA\n [type] => open\n [level] => 1\n)\n");
|
||||
VS(f_print_r(vals.rvalAt(1),1),
|
||||
"Array\n(\n [tag] => NOTE\n [type] => complete\n [level] => 2\n"
|
||||
" [attributes] => Array\n (\n [ATTRIB1] => foo\n"
|
||||
" )\n\n [value] => simple¬e\n)\n");
|
||||
VS(f_print_r(vals.rvalAt(2),1),
|
||||
"Array\n(\n [tag] => PARA\n [type] => close\n [level] => 1\n)\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXml::test_xml_parser_create_ns() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXml::test_xml_parser_get_option() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXml::test_xml_parser_set_option() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXml::test_xml_set_character_data_handler() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXml::test_xml_set_default_handler() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXml::test_xml_set_element_handler() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXml::test_xml_set_processing_instruction_handler() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXml::test_xml_set_start_namespace_decl_handler() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXml::test_xml_set_end_namespace_decl_handler() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXml::test_xml_set_unparsed_entity_decl_handler() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXml::test_xml_set_external_entity_ref_handler() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXml::test_xml_set_notation_decl_handler() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXml::test_xml_set_object() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXml::test_xml_get_current_byte_index() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXml::test_xml_get_current_column_number() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXml::test_xml_get_current_line_number() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXml::test_xml_get_error_code() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXml::test_xml_error_string() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXml::test_utf8_decode() {
|
||||
VS(f_utf8_decode("abc \xc3\x80 def"), "abc \xc0 def");
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtXml::test_utf8_encode() {
|
||||
VS(f_utf8_encode("abc \xc0 def"), "abc \xc3\x80 def");
|
||||
return Count(true);
|
||||
}
|
||||
@@ -1,58 +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_XML_H_
|
||||
#define incl_HPHP_TEST_EXT_XML_H_
|
||||
|
||||
// >>>>>> Generated by idl.php. Do NOT modify. <<<<<<
|
||||
|
||||
#include "hphp/test/ext/test_cpp_ext.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class TestExtXml : public TestCppExt {
|
||||
public:
|
||||
virtual bool RunTests(const std::string &which);
|
||||
|
||||
bool test_xml_parser_create();
|
||||
bool test_xml_parser_free();
|
||||
bool test_xml_parse();
|
||||
bool test_xml_parse_into_struct();
|
||||
bool test_xml_parser_create_ns();
|
||||
bool test_xml_parser_get_option();
|
||||
bool test_xml_parser_set_option();
|
||||
bool test_xml_set_character_data_handler();
|
||||
bool test_xml_set_default_handler();
|
||||
bool test_xml_set_element_handler();
|
||||
bool test_xml_set_processing_instruction_handler();
|
||||
bool test_xml_set_start_namespace_decl_handler();
|
||||
bool test_xml_set_end_namespace_decl_handler();
|
||||
bool test_xml_set_unparsed_entity_decl_handler();
|
||||
bool test_xml_set_external_entity_ref_handler();
|
||||
bool test_xml_set_notation_decl_handler();
|
||||
bool test_xml_set_object();
|
||||
bool test_xml_get_current_byte_index();
|
||||
bool test_xml_get_current_column_number();
|
||||
bool test_xml_get_current_line_number();
|
||||
bool test_xml_get_error_code();
|
||||
bool test_xml_error_string();
|
||||
bool test_utf8_decode();
|
||||
bool test_utf8_encode();
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // incl_HPHP_TEST_EXT_XML_H_
|
||||
@@ -1,46 +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_xmlreader.h"
|
||||
#include "hphp/runtime/ext/ext_xmlreader.h"
|
||||
|
||||
IMPLEMENT_SEP_EXTENSION_TEST(Xmlreader);
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TestExtXmlreader::RunTests(const std::string &which) {
|
||||
bool ret = true;
|
||||
|
||||
RUN_TEST(test_XMLReader);
|
||||
RUN_TEST(test_XMLReader_getattribute);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TestExtXmlreader::test_XMLReader() {
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtXmlreader::test_XMLReader_getattribute() {
|
||||
p_XMLReader reader(NEWOBJ(c_XMLReader)());
|
||||
reader->t_xml("<?xml version=\"1.0\" encoding=\"UTF-8\"?><a y=\"\" z=\"1\"></a>");
|
||||
reader->t_read();
|
||||
VS(reader->t_getattribute("x"), uninit_null());
|
||||
VS(reader->t_getattribute("y"), String(""));
|
||||
VS(reader->t_getattribute("z"), String("1"));
|
||||
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_XMLREADER_H_
|
||||
#define incl_HPHP_TEST_EXT_XMLREADER_H_
|
||||
|
||||
// >>>>>> Generated by idl.php. Do NOT modify. <<<<<<
|
||||
|
||||
#include "hphp/test/ext/test_cpp_ext.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class TestExtXmlreader : public TestCppExt {
|
||||
public:
|
||||
virtual bool RunTests(const std::string &which);
|
||||
|
||||
bool test_XMLReader();
|
||||
bool test_XMLReader_getattribute();
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // incl_HPHP_TEST_EXT_XMLREADER_H_
|
||||
@@ -1,291 +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_xmlwriter.h"
|
||||
#include "hphp/runtime/ext/ext_xmlwriter.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TestExtXmlwriter::RunTests(const std::string &which) {
|
||||
bool ret = true;
|
||||
|
||||
RUN_TEST(test_xmlwriter_open_memory);
|
||||
RUN_TEST(test_xmlwriter_open_uri);
|
||||
RUN_TEST(test_xmlwriter_set_indent_string);
|
||||
RUN_TEST(test_xmlwriter_set_indent);
|
||||
RUN_TEST(test_xmlwriter_start_document);
|
||||
RUN_TEST(test_xmlwriter_start_element);
|
||||
RUN_TEST(test_xmlwriter_start_element_ns);
|
||||
RUN_TEST(test_xmlwriter_write_element_ns);
|
||||
RUN_TEST(test_xmlwriter_write_element);
|
||||
RUN_TEST(test_xmlwriter_end_element);
|
||||
RUN_TEST(test_xmlwriter_full_end_element);
|
||||
RUN_TEST(test_xmlwriter_start_attribute_ns);
|
||||
RUN_TEST(test_xmlwriter_start_attribute);
|
||||
RUN_TEST(test_xmlwriter_write_attribute_ns);
|
||||
RUN_TEST(test_xmlwriter_write_attribute);
|
||||
RUN_TEST(test_xmlwriter_end_attribute);
|
||||
RUN_TEST(test_xmlwriter_start_cdata);
|
||||
RUN_TEST(test_xmlwriter_write_cdata);
|
||||
RUN_TEST(test_xmlwriter_end_cdata);
|
||||
RUN_TEST(test_xmlwriter_start_comment);
|
||||
RUN_TEST(test_xmlwriter_write_comment);
|
||||
RUN_TEST(test_xmlwriter_end_comment);
|
||||
RUN_TEST(test_xmlwriter_end_document);
|
||||
RUN_TEST(test_xmlwriter_start_pi);
|
||||
RUN_TEST(test_xmlwriter_write_pi);
|
||||
RUN_TEST(test_xmlwriter_end_pi);
|
||||
RUN_TEST(test_xmlwriter_text);
|
||||
RUN_TEST(test_xmlwriter_write_raw);
|
||||
RUN_TEST(test_xmlwriter_start_dtd);
|
||||
RUN_TEST(test_xmlwriter_write_dtd);
|
||||
RUN_TEST(test_xmlwriter_start_dtd_element);
|
||||
RUN_TEST(test_xmlwriter_write_dtd_element);
|
||||
RUN_TEST(test_xmlwriter_end_dtd_element);
|
||||
RUN_TEST(test_xmlwriter_start_dtd_attlist);
|
||||
RUN_TEST(test_xmlwriter_write_dtd_attlist);
|
||||
RUN_TEST(test_xmlwriter_end_dtd_attlist);
|
||||
RUN_TEST(test_xmlwriter_start_dtd_entity);
|
||||
RUN_TEST(test_xmlwriter_write_dtd_entity);
|
||||
RUN_TEST(test_xmlwriter_end_dtd_entity);
|
||||
RUN_TEST(test_xmlwriter_end_dtd);
|
||||
RUN_TEST(test_xmlwriter_flush);
|
||||
RUN_TEST(test_xmlwriter_output_memory);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_open_memory() {
|
||||
Variant xml = f_xmlwriter_open_memory();
|
||||
VERIFY(f_xmlwriter_set_indent(xml, true));
|
||||
VERIFY(f_xmlwriter_set_indent_string(xml, " "));
|
||||
VERIFY(f_xmlwriter_start_document(xml, "1.0", "utf-8"));
|
||||
VERIFY(f_xmlwriter_start_element(xml, "node"));
|
||||
VERIFY(f_xmlwriter_write_attribute(xml, "name", "value"));
|
||||
VERIFY(f_xmlwriter_write_element(xml, "subnode", "some text"));
|
||||
VERIFY(f_xmlwriter_end_element(xml));
|
||||
VERIFY(f_xmlwriter_end_document(xml));
|
||||
String out = f_xmlwriter_flush(xml);
|
||||
VS(out, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<node name=\"value\">\n <subnode>some text</subnode>\n</node>\n");
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_open_uri() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_set_indent_string() {
|
||||
// tested in test_xmlwriter_open_memory
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_set_indent() {
|
||||
// tested in test_xmlwriter_open_memory
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_start_document() {
|
||||
// tested in test_xmlwriter_open_memory
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_start_element() {
|
||||
// tested in test_xmlwriter_open_memory
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_start_element_ns() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_write_element_ns() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_write_element() {
|
||||
// tested in test_xmlwriter_open_memory
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_end_element() {
|
||||
// tested in test_xmlwriter_open_memory
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_full_end_element() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_start_attribute_ns() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_start_attribute() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_write_attribute_ns() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_write_attribute() {
|
||||
// tested in test_xmlwriter_open_memory
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_end_attribute() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_start_cdata() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_write_cdata() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_end_cdata() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_start_comment() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_write_comment() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_end_comment() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_end_document() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_start_pi() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_write_pi() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_end_pi() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_text() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_write_raw() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_start_dtd() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_write_dtd() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_start_dtd_element() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_write_dtd_element() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_end_dtd_element() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_start_dtd_attlist() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_write_dtd_attlist() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_end_dtd_attlist() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_start_dtd_entity() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_write_dtd_entity() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_end_dtd_entity() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_end_dtd() {
|
||||
//VCB("<?php ");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_flush() {
|
||||
// tested in test_xmlwriter_open_memory
|
||||
return Count(true);
|
||||
}
|
||||
|
||||
bool TestExtXmlwriter::test_xmlwriter_output_memory() {
|
||||
// tested in test_xmlwriter_open_memory
|
||||
return Count(true);
|
||||
}
|
||||
@@ -1,77 +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_XMLWRITER_H_
|
||||
#define incl_HPHP_TEST_EXT_XMLWRITER_H_
|
||||
|
||||
// >>>>>> Generated by idl.php. Do NOT modify. <<<<<<
|
||||
|
||||
#include "hphp/test/ext/test_cpp_ext.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class TestExtXmlwriter : public TestCppExt {
|
||||
public:
|
||||
virtual bool RunTests(const std::string &which);
|
||||
|
||||
bool test_xmlwriter_open_memory();
|
||||
bool test_xmlwriter_open_uri();
|
||||
bool test_xmlwriter_set_indent_string();
|
||||
bool test_xmlwriter_set_indent();
|
||||
bool test_xmlwriter_start_document();
|
||||
bool test_xmlwriter_start_element();
|
||||
bool test_xmlwriter_start_element_ns();
|
||||
bool test_xmlwriter_write_element_ns();
|
||||
bool test_xmlwriter_write_element();
|
||||
bool test_xmlwriter_end_element();
|
||||
bool test_xmlwriter_full_end_element();
|
||||
bool test_xmlwriter_start_attribute_ns();
|
||||
bool test_xmlwriter_start_attribute();
|
||||
bool test_xmlwriter_write_attribute_ns();
|
||||
bool test_xmlwriter_write_attribute();
|
||||
bool test_xmlwriter_end_attribute();
|
||||
bool test_xmlwriter_start_cdata();
|
||||
bool test_xmlwriter_write_cdata();
|
||||
bool test_xmlwriter_end_cdata();
|
||||
bool test_xmlwriter_start_comment();
|
||||
bool test_xmlwriter_write_comment();
|
||||
bool test_xmlwriter_end_comment();
|
||||
bool test_xmlwriter_end_document();
|
||||
bool test_xmlwriter_start_pi();
|
||||
bool test_xmlwriter_write_pi();
|
||||
bool test_xmlwriter_end_pi();
|
||||
bool test_xmlwriter_text();
|
||||
bool test_xmlwriter_write_raw();
|
||||
bool test_xmlwriter_start_dtd();
|
||||
bool test_xmlwriter_write_dtd();
|
||||
bool test_xmlwriter_start_dtd_element();
|
||||
bool test_xmlwriter_write_dtd_element();
|
||||
bool test_xmlwriter_end_dtd_element();
|
||||
bool test_xmlwriter_start_dtd_attlist();
|
||||
bool test_xmlwriter_write_dtd_attlist();
|
||||
bool test_xmlwriter_end_dtd_attlist();
|
||||
bool test_xmlwriter_start_dtd_entity();
|
||||
bool test_xmlwriter_write_dtd_entity();
|
||||
bool test_xmlwriter_end_dtd_entity();
|
||||
bool test_xmlwriter_end_dtd();
|
||||
bool test_xmlwriter_flush();
|
||||
bool test_xmlwriter_output_memory();
|
||||
bool test_xmlwriter();
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // incl_HPHP_TEST_EXT_XMLWRITER_H_
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
function VS($x, $y) {
|
||||
var_dump($x === $y);
|
||||
if ($x !== $y) { echo "Failed: $y\n"; }
|
||||
}
|
||||
|
||||
VS(utf8_decode("abc \xc3\x80 def"), "abc \xc0 def");
|
||||
VS(utf8_encode("abc \xc0 def"), "abc \xc3\x80 def");
|
||||
|
||||
// xml_parse_into_struct ..
|
||||
|
||||
$simple = "<para><note attrib1='foo'>simple&note</note></para>";
|
||||
$p = xml_parser_create();
|
||||
xml_parse_into_struct($p, $simple, $vals, $index);
|
||||
xml_parser_free($p);
|
||||
|
||||
var_dump($index["PARA"]);
|
||||
var_dump($index["NOTE"]);
|
||||
var_dump($vals[0]);
|
||||
var_dump($vals[1]);
|
||||
var_dump($vals[2]);
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
bool(true)
|
||||
bool(true)
|
||||
array(2) {
|
||||
[0]=>
|
||||
int(0)
|
||||
[1]=>
|
||||
int(2)
|
||||
}
|
||||
array(1) {
|
||||
[0]=>
|
||||
int(1)
|
||||
}
|
||||
array(3) {
|
||||
["tag"]=>
|
||||
string(4) "PARA"
|
||||
["type"]=>
|
||||
string(4) "open"
|
||||
["level"]=>
|
||||
int(1)
|
||||
}
|
||||
array(5) {
|
||||
["tag"]=>
|
||||
string(4) "NOTE"
|
||||
["type"]=>
|
||||
string(8) "complete"
|
||||
["level"]=>
|
||||
int(2)
|
||||
["attributes"]=>
|
||||
array(1) {
|
||||
["ATTRIB1"]=>
|
||||
string(3) "foo"
|
||||
}
|
||||
["value"]=>
|
||||
string(11) "simple¬e"
|
||||
}
|
||||
array(3) {
|
||||
["tag"]=>
|
||||
string(4) "PARA"
|
||||
["type"]=>
|
||||
string(5) "close"
|
||||
["level"]=>
|
||||
int(1)
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
function VS($x, $y) {
|
||||
var_dump($x === $y);
|
||||
if ($x !== $y) { echo "Failed: $y\n"; }
|
||||
}
|
||||
|
||||
|
||||
$reader = new XMLReader();
|
||||
$reader->xml("<?xml version=\"1.0\" encoding=\"UTF-8\"?><a y=\"\" z=\"1\"></a>");
|
||||
$reader->read();
|
||||
VS($reader->getattribute("x"), null);
|
||||
VS($reader->getattribute("y"), "");
|
||||
VS($reader->getattribute("z"), "1");
|
||||
@@ -0,0 +1,3 @@
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
function VS($x, $y) {
|
||||
var_dump($x === $y);
|
||||
if ($x !== $y) { echo "Failed: $y\n"; echo "got: $x\n"; }
|
||||
}
|
||||
|
||||
function VERIFY($x) {
|
||||
VS($x, true);
|
||||
}
|
||||
|
||||
$xml = xmlwriter_open_memory();
|
||||
VERIFY(xmlwriter_set_indent($xml, true));
|
||||
VERIFY(xmlwriter_set_indent_string($xml, " "));
|
||||
VERIFY(xmlwriter_start_document($xml, "1.0", "utf-8"));
|
||||
VERIFY(xmlwriter_start_element($xml, "node"));
|
||||
VERIFY(xmlwriter_write_attribute($xml, "name", "value"));
|
||||
VERIFY(xmlwriter_write_element($xml, "subnode", "some text"));
|
||||
VERIFY(xmlwriter_end_element($xml));
|
||||
VERIFY(xmlwriter_end_document($xml));
|
||||
$out = xmlwriter_flush($xml);
|
||||
VS($out, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<node name=\"value\">\n <subnode>some text</subnode>\n</node>\n");
|
||||
@@ -0,0 +1,9 @@
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
Referência em uma Nova Issue
Bloquear um usuário