Skip to content
Browse files

Get tests working (adjust file structure, remove broken/duplicative A…

…llTests.php [use "pear run-tests -r tests" instead], adjust paths) (bug #19173).

git-svn-id: https://svn.php.net/repository/pear/packages/XML_Parser/trunk@321544 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent 7a60948 commit eeaea6e574ae76007e32f9ed69a4f012be1cdf15 Daniel Convissor committed Dec 30, 2011
Showing with 13 additions and 161 deletions.
  1. 0 { → XML}/Parser.php
  2. 0 { → XML}/Parser/Simple.php
  3. +7 −3 package.xml
  4. +1 −6 tests/001.phpt
  5. +2 −7 tests/002.phpt
  6. +2 −7 tests/003.phpt
  7. +1 −6 tests/004b.phpt
  8. +0 −132 tests/AllTests.php
View
0 Parser.php → XML/Parser.php
File renamed without changes.
View
0 Parser/Simple.php → XML/Parser/Simple.php
File renamed without changes.
View
10 package.xml
@@ -48,6 +48,13 @@ Remove package.php from release
</notes>
<contents>
<dir baseinstalldir="XML" name="/">
+ <dir name="XML">
+ <file md5sum="83d7130b17386b7d163003f11e5cdf5b" name="Parser.php" role="php" />
+ <dir name="Parser">
+ <file md5sum="88ef6410c394195a5d6740d0cf9a6d9a" name="Simple.php" role="php" />
+ </dir>
+ </dir>
+
<file baseinstalldir="XML" md5sum="88f4675e960d07abb4b53406923fee90" name="examples/xml_parser_file.php" role="doc" />
<file baseinstalldir="XML" md5sum="48d354dd3d0ab55a4078ae5c3c1340ea" name="examples/xml_parser_file.xml" role="doc" />
<file baseinstalldir="XML" md5sum="9d16033d9d2f15df41a8f7208209deb1" name="examples/xml_parser_funcmode.php" role="doc" />
@@ -57,21 +64,18 @@ Remove package.php from release
<file baseinstalldir="XML" md5sum="9fb1cbc541788cc653bdd3d66b9e4c41" name="examples/xml_parser_simple2.php" role="doc" />
<file baseinstalldir="XML" md5sum="ad866824329ffbd32743a97b78405b40" name="examples/xml_parser_simple2.xml" role="doc" />
<file baseinstalldir="XML" md5sum="4dc0ca1c7898a4da0c559a813f58068c" name="examples/xml_parser_simple_handler.php" role="doc" />
- <file baseinstalldir="XML" md5sum="88ef6410c394195a5d6740d0cf9a6d9a" name="Parser/Simple.php" role="php" />
<file baseinstalldir="XML" md5sum="c8b3925caafec04114ce46b590d8e21b" name="tests/001.phpt" role="test" />
<file baseinstalldir="XML" md5sum="127466ab6483e636f7f99ce44dee6bfd" name="tests/002.phpt" role="test" />
<file baseinstalldir="XML" md5sum="bdac6b971b9a30db1d881e3ec4494e96" name="tests/003.phpt" role="test" />
<file baseinstalldir="XML" md5sum="034536524d8b092a05b0d6ab75ec229c" name="tests/004.phpt" role="test" />
<file baseinstalldir="XML" md5sum="9e2f8319efd3585757385c54193db965" name="tests/004b.phpt" role="test" />
<file baseinstalldir="XML" md5sum="1ef453ddc2e206b2d36aaa0fb033baae" name="tests/005.phpt" role="test" />
- <file baseinstalldir="XML" md5sum="74196cbb41d3554beed6bfc6b2962163" name="tests/AllTests.php" role="test" />
<file baseinstalldir="XML" md5sum="8b33aaf8d12e650bdb79b4f7f9afbc86" name="tests/bug-9328.phpt" role="test" />
<file baseinstalldir="XML" md5sum="2d80348998a6964e2933de5466bfe3ce" name="tests/bug-9328b.phpt" role="test" />
<file baseinstalldir="XML" md5sum="2aa6e822875c20d3b813dd15e438de53" name="tests/bug-9328c.phpt" role="test" />
<file baseinstalldir="XML" md5sum="d4400734126a7aa92a0a91812f48bfb7" name="tests/bug-9328d.phpt" role="test" />
<file baseinstalldir="XML" md5sum="21dc5257d037acc919a99f6b861a80bf" name="tests/test2.xml" role="test" />
<file baseinstalldir="XML" md5sum="21dc5257d037acc919a99f6b861a80bf" name="tests/test3.xml" role="test" />
- <file baseinstalldir="XML" md5sum="83d7130b17386b7d163003f11e5cdf5b" name="Parser.php" role="php" />
</dir>
</contents>
<dependencies>
View
7 tests/001.phpt
@@ -10,12 +10,7 @@ XML Parser: parse simple string
// - some handlers
// - parse simple string
//
-chdir (dirname(__FILE__));
-if (file_exists('../Parser.php')) {
- require_once "../Parser.php";
-} else {
- require_once "XML/Parser.php";
-}
+require_once "XML/Parser.php";
class __TestParser1 extends XML_Parser {
function __TestParser1() {
View
9 tests/002.phpt
@@ -10,12 +10,7 @@ XML Parser: parse from file
// - some handlers
// - parse from file
//
-chdir (dirname(__FILE__));
-if (file_exists('../Parser.php')) {
- require_once "../Parser.php";
-} else {
- require_once "XML/Parser.php";
-}
+require_once "XML/Parser.php";
class __TestParser2 extends XML_Parser {
function __TestParser2() {
@@ -43,7 +38,7 @@ class __TestParser2 extends XML_Parser {
print "new __TestParser2 ";
var_dump(strtolower(get_class($o = new __TestParser2())));
print "setInputFile ";
-print is_resource($o->setInputFile("test2.xml"))."\n";
+print is_resource($o->setInputFile(dirname(__FILE__) . "/test2.xml"))."\n";
print "parse ";
var_dump($o->parse());
View
9 tests/003.phpt
@@ -10,12 +10,7 @@ XML Parser: parse from file resource
// - some handlers
// - parse from file resource
//
-chdir (dirname(__FILE__));
-if (file_exists('../Parser.php')) {
- require_once "../Parser.php";
-} else {
- require_once "XML/Parser.php";
-}
+require_once "XML/Parser.php";
class __TestParser3 extends XML_Parser {
function __TestParser3() {
@@ -43,7 +38,7 @@ class __TestParser3 extends XML_Parser {
print "new __TestParser3 ";
var_dump(strtolower(get_class($o = new __TestParser3())));
print "fopen ";
-print is_resource($fp = fopen("test3.xml", "r"))."\n";
+print is_resource($fp = fopen(dirname(__FILE__) . "/test3.xml", "r"))."\n";
print "setInput ";
var_dump($o->setInput($fp));
print "parse ";
View
7 tests/004b.phpt
@@ -11,12 +11,7 @@ if (!extension_loaded('xml')) {
?>
--FILE--
<?php
-chdir (dirname(__FILE__));
-if (file_exists('../Parser.php')) {
- require_once "../Parser.php";
-} else {
- require_once "XML/Parser.php";
-}
+require_once "XML/Parser.php";
print 'New XML_Parser: ';
var_dump(strtolower(get_class($p = new XML_Parser())));
View
132 tests/AllTests.php
@@ -1,132 +0,0 @@
-<?php
-
-/**
- * Master Unit Test Suite file for XML_Parser
- *
- * This top-level test suite file organizes
- * all class test suite files,
- * so that the full suite can be run
- * by PhpUnit or via "pear run-tests -u".
- *
- * PHP version 5
- *
- * @category XML
- * @package XML_Parser
- * @subpackage UnitTesting
- * @author Chuck Burgess <ashnazg@php.net>
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id$
- * @link http://pear.php.net/package/XML_Parser
- * @since 1.3.2
- */
-
-
-/**
- * Check PHP version... PhpUnit v3+ requires at least PHP v5.1.4
- */
-if (version_compare(PHP_VERSION, "5.1.4") < 0) {
- // Cannnot run test suites
- echo 'Cannot run test suite via PhpUnit... requires at least PHP v5.1.4.' . PHP_EOL;
- echo 'Use "pear run-tests -p xml_util" to run the PHPT tests directly.' . PHP_EOL
-;
- exit(1);
-}
-
-
-/**
- * Derive the "main" method name
- * @internal PhpUnit would have to rename PHPUnit_MAIN_METHOD to PHPUNIT_MAIN_METHOD
- * to make this usage meet the PEAR CS... we cannot rename it here.
- */
-if (!defined('PHPUnit_MAIN_METHOD')) {
- define('PHPUnit_MAIN_METHOD', 'XML_Parser_AllTests::main');
-}
-
-
-/*
- * Files needed by PhpUnit
- */
-require_once 'PHPUnit/Framework.php';
-require_once 'PHPUnit/TextUI/TestRunner.php';
-require_once 'PHPUnit/Extensions/PhptTestSuite.php';
-
-/*
- * You must add each additional class-level test suite file here
- */
-// there are no PhpUnit test files... only PHPTs.. so nothing is listed here
-
-/**
- * directory where PHPT tests are located
- */
-define('XML_PARSER_DIR_PHPT', dirname(__FILE__));
-
-/**
- * Master Unit Test Suite class for XML_Parser
- *
- * This top-level test suite class organizes
- * all class test suite files,
- * so that the full suite can be run
- * by PhpUnit or via "pear run-tests -up xml_util".
- *
- * @category XML
- * @package XML_Parser
- * @subpackage UnitTesting
- * @author Chuck Burgess <ashnazg@php.net>
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/XML_Parser
- * @since 1.2.0a1
- */
-class XML_Parser_AllTests
-{
-
- /**
- * Launches the TextUI test runner
- *
- * @return void
- * @uses PHPUnit_TextUI_TestRunner
- */
- public static function main()
- {
- PHPUnit_TextUI_TestRunner::run(self::suite());
- }
-
-
- /**
- * Adds all class test suites into the master suite
- *
- * @return PHPUnit_Framework_TestSuite a master test suite
- * containing all class test suites
- * @uses PHPUnit_Framework_TestSuite
- */
- public static function suite()
- {
- $suite = new PHPUnit_Framework_TestSuite(
- 'XML_Parser Full Suite of Unit Tests');
-
- /*
- * You must add each additional class-level test suite name here
- */
- // there are no PhpUnit test files... only PHPTs.. so nothing is listed here
-
- /*
- * add PHPT tests
- */
- $phpt = new PHPUnit_Extensions_PhptTestSuite(XML_PARSER_DIR_PHPT);
- $suite->addTestSuite($phpt);
-
- return $suite;
- }
-}
-
-/**
- * Call the main method if this file is executed directly
- * @internal PhpUnit would have to rename PHPUnit_MAIN_METHOD to PHPUNIT_MAIN_METHOD
- * to make this usage meet the PEAR CS... we cannot rename it here.
- */
-if (PHPUnit_MAIN_METHOD == 'XML_Parser_AllTests::main') {
- XML_Parser_AllTests::main();
-}
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-?>

0 comments on commit eeaea6e

Please sign in to comment.
Something went wrong with that request. Please try again.