]> granicus.if.org Git - php/commitdiff
fix test to not hit php.net
authorStanislav Malyshev <stas@php.net>
Thu, 5 Feb 2015 08:06:25 +0000 (00:06 -0800)
committerStanislav Malyshev <stas@php.net>
Thu, 5 Feb 2015 08:41:51 +0000 (00:41 -0800)
ext/standard/tests/network/http-stream.phpt
ext/standard/tests/network/news.rss [new file with mode: 0644]

index 99245f709e296301c4e864fd8bb8fd64a3f0c54b..1186060096a68febd219768583221b2bbd7c2799 100644 (file)
@@ -3,16 +3,22 @@ http-stream test
 --SKIPIF--
 <?php
 if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
-if (getenv("SKIP_ONLINE_TESTS")) die("skip online test");
 if (!extension_loaded("dom")) die("skip dom extension is not present");
+require __DIR__.'/../http/server.inc';
+http_server_skipif('tcp://127.0.0.1:12342');
 ?>
 --INI--
 allow_url_fopen=1
 --FILE--
 <?php
+require __DIR__.'/../http/server.inc';
+
+$pid = http_server("tcp://127.0.0.1:12342", [__DIR__."/news.rss"]);
+
 $d = new DomDocument;
-$e = $d->load("http://php.net/news.rss");
+$e = $d->load("http://127.0.0.1:12342/news.rss");
 echo "ALIVE\n";
+http_server_kill($pid);
 ?>
 --EXPECTF--
 ALIVE
diff --git a/ext/standard/tests/network/news.rss b/ext/standard/tests/network/news.rss
new file mode 100644 (file)
index 0000000..f80b82c
--- /dev/null
@@ -0,0 +1,28 @@
+HTTP/1.1 200 OK
+Content-Type: text/xml
+
+<?xml version="1.0" encoding="utf-8"?>
+<rdf:RDF
+       xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+       xmlns="http://purl.org/rss/1.0/"
+       xmlns:dc="http://purl.org/dc/elements/1.1/"
+>
+<channel rdf:about="http://php.net/">
+       <title>PHP: Hypertext Preprocessor</title>
+       <link>http://php.net/</link>
+       <description>The PHP scripting language web site</description>
+       <items>
+               <rdf:Seq>
+                       <rdf:li rdf:resource="http://php.net/index.php#id2015-01-22-3" />
+               </rdf:Seq>
+       </items>
+</channel>
+
+<item rdf:about="http://php.net/index.php#id2015-01-22-3">
+       <title>PHP 5.4.37 Released</title>
+       <link>http://php.net/index.php#id2015-01-22-3</link>
+       <description>The PHP development team announces the immediate availability of PHP 5.4.37. Six security-related bugs were fixed in this release, including CVE-2015-0231, CVE-2014-9427 and CVE-2015-0232. All PHP 5.4 users are encouraged to upgrade to this version. For source downloads of PHP 5.4.37 please visit our downloads page, Windows binaries can be found on windows.php.net/download/. The list of changes is recorded in the ChangeLog.</description>
+       <dc:date>2015-01-22</dc:date>
+</item>
+
+</rdf:RDF>