Permalink
Browse files

Upgrade PHPUnit require statements plus other fixes to get tests work…

…ing(Bug #19122).

git-svn-id: http://svn.php.net/repository/pear/packages/HTTP_Download/trunk@320826 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent 1c6ca7d commit 3ac986ab3ba8be3f8ab8708fbeba4dc9a6ff60e6 Daniel Convissor committed Dec 10, 2011
Showing with 27 additions and 3 deletions.
  1. +3 −0 package.xml
  2. +2 −0 tests/AllTests.php
  3. +4 −3 tests/HTTP_DownloadTest.php
  4. +18 −0 tests/helper.inc
View
@@ -52,6 +52,9 @@ DIR layout
<file baseinstalldir="/" md5sum="18cad0fdf358f1982e4fe189b1df0186" name="HTTP/Download/PgLOB.php" role="php" />
<file baseinstalldir="/" md5sum="2925fca8fe2e0b54afca58632dd82195" name="tests/AllTests.php" role="test" />
<file baseinstalldir="HTTP" md5sum="49cb3608e2b33fad6b65df8cb8f49668" name="tests/data.txt" role="test" />
+ <file baseinstalldir="HTTP" md5sum="ef5bdfce6f4bd82db0ef382512a16d67" name="tests/helper.inc" role="test">
+ <tasks:replace from="@include_path@" to="php_dir" type="pear-config" />
+ </file>
<file baseinstalldir="/" md5sum="55534b1b8d57d35c46238cfd701a6aa5" name="tests/HTTP_DownloadTest.php" role="test" />
<file baseinstalldir="HTTP" md5sum="20938f4ce9bb39340fd1a6b60c5ca7d2" name="tests/send.php" role="test" />
<file baseinstalldir="HTTP" md5sum="8f678fe06ab84642adc04a7c7bd3e34b" name="LICENSE" role="doc" />
View
@@ -1,5 +1,7 @@
<?php
+require_once dirname(__FILE__) . '/helper.inc';
+
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'HTML_Download_AllTests::main');
}
@@ -1,6 +1,7 @@
<?php
-require_once 'PHPUnit/Framework.php';
+require_once dirname(__FILE__) . '/helper.inc';
+
require_once 'HTTP/Download.php';
require_once 'HTTP/Request.php';
@@ -85,7 +86,7 @@ function testguessContentType()
function _send($op)
{
- if (!file_get_contents($this->testScript)) {
+ if (!@file_get_contents($this->testScript)) {
$this->markTestSkipped($this->testScript . " is not available");
}
$complete = str_repeat('1234567890',10);
@@ -206,7 +207,7 @@ function teststaticSend()
function testsendArchive()
{
- if (!file_get_contents($this->testScript)) {
+ if (!@file_get_contents($this->testScript)) {
$this->markTestSkipped($this->testScript . " is not available");
}
View
@@ -0,0 +1,18 @@
+<?php
+
+if ($fp = @fopen('PHPUnit/Autoload.php', 'r', true)) {
+ require_once 'PHPUnit/Autoload.php';
+} elseif ($fp = @fopen('PHPUnit/Framework.php', 'r', true)) {
+ require_once 'PHPUnit/Framework.php';
+} else {
+ die('skip could not find PHPUnit');
+}
+fclose($fp);
+
+if ('@include_path@' == '@'.'include_path'.'@') {
+ // This package hasn't been installed.
+ // Adjust path to ensure includes find files in working directory.
+ ini_set('include_path',
+ dirname(dirname(__FILE__))
+ . PATH_SEPARATOR . ini_get('include_path'));
+}

0 comments on commit 3ac986a

Please sign in to comment.