summaryrefslogtreecommitdiff
path: root/_test
diff options
context:
space:
mode:
Diffstat (limited to '_test')
-rw-r--r--_test/tests/inc/httpclient_http_proxy.test.php4
-rw-r--r--_test/tests/inc/httpclient_https_proxy.test.php4
-rw-r--r--_test/tests/inc/io_readfile.test.php53
-rw-r--r--_test/tests/inc/io_readfile/corrupt.txt.bz21
-rw-r--r--_test/tests/inc/io_readfile/corrupt.txt.gzbin0 -> 31 bytes
-rw-r--r--_test/tests/inc/io_readfile/test.txt.bz2bin0 -> 49 bytes
-rw-r--r--_test/tests/inc/io_readfile/test.txt.gzbin0 -> 31 bytes
7 files changed, 58 insertions, 4 deletions
diff --git a/_test/tests/inc/httpclient_http_proxy.test.php b/_test/tests/inc/httpclient_http_proxy.test.php
index c44dc7ed7..dae801dbd 100644
--- a/_test/tests/inc/httpclient_http_proxy.test.php
+++ b/_test/tests/inc/httpclient_http_proxy.test.php
@@ -3,7 +3,7 @@
require_once (__DIR__ . '/httpclient_mock.php');
class httpclient_http_proxy_test extends DokuWikiTest {
- protected $url = 'http://test.dokuwiki.org/README';
+ protected $url = 'http://httpbin.org/user-agent';
/**
* @group internet
@@ -15,7 +15,7 @@ class httpclient_http_proxy_test extends DokuWikiTest {
$http->proxy_port = 8080;
$data = $http->get($this->url);
- $this->assertFalse($data === false, 'HTTP response '.$http->error);
+ $this->assertFalse($data === false, 'HTTP response: '.$http->error.' ['.$this->url.']');
$this->assertTrue(strpos($data,'DokuWiki') !== false, 'response content');
}
} \ No newline at end of file
diff --git a/_test/tests/inc/httpclient_https_proxy.test.php b/_test/tests/inc/httpclient_https_proxy.test.php
index 9402e91af..cf5b9a8b9 100644
--- a/_test/tests/inc/httpclient_https_proxy.test.php
+++ b/_test/tests/inc/httpclient_https_proxy.test.php
@@ -2,7 +2,7 @@
require_once dirname(__FILE__).'/httpclient_http_proxy.test.php';
class httpclient_https_proxy_test extends httpclient_http_proxy_test {
- protected $url = 'https://www.dokuwiki.org/README';
+ protected $url = 'https://httpbin.org/user-agent';
public function setUp(){
// skip tests when this PHP has no SSL support
@@ -27,4 +27,4 @@ class httpclient_https_proxy_test extends httpclient_http_proxy_test {
$this->assertFalse($data);
$this->assertEquals(-150, $http->status);
}
-} \ No newline at end of file
+}
diff --git a/_test/tests/inc/io_readfile.test.php b/_test/tests/inc/io_readfile.test.php
new file mode 100644
index 000000000..e3e90cd8d
--- /dev/null
+++ b/_test/tests/inc/io_readfile.test.php
@@ -0,0 +1,53 @@
+<?php
+
+class io_readfile_test extends DokuWikiTest {
+
+ /*
+ * dependency for tests needing zlib extension to pass
+ */
+ public function test_ext_zlib() {
+ if (!extension_loaded('zlib')) {
+ $this->markTestSkipped('skipping all zlib tests. Need zlib extension');
+ }
+ }
+
+ /*
+ * dependency for tests needing zlib extension to pass
+ */
+ public function test_ext_bz2() {
+ if (!extension_loaded('bz2')) {
+ $this->markTestSkipped('skipping all bzip2 tests. Need bz2 extension');
+ }
+ }
+
+ function test_plain(){
+ // since git converts line endings, we can't check in this test file but have to create it ourselves
+ $plain = TMP_DIR.'/test.txt';
+ file_put_contents($plain, "The\015\012Test\015\012");
+
+ $this->assertEquals("The\012Test\012", io_readFile($plain));
+ $this->assertEquals("The\015\012Test\015\012", io_readFile($plain, false));
+ $this->assertEquals(false, io_readFile(__DIR__.'/io_readfile/nope.txt'));
+ }
+
+ /**
+ * @depends test_ext_zlib
+ */
+ function test_gzfiles(){
+ $this->assertEquals("The\012Test\012", io_readFile(__DIR__.'/io_readfile/test.txt.gz'));
+ $this->assertEquals("The\015\012Test\015\012", io_readFile(__DIR__.'/io_readfile/test.txt.gz', false));
+ $this->assertEquals(false, io_readFile(__DIR__.'/io_readfile/nope.txt.gz'));
+ $this->assertEquals(false, io_readFile(__DIR__.'/io_readfile/corrupt.txt.gz'));
+ }
+
+ /**
+ * @depends test_ext_bz2
+ */
+ function test_bzfiles(){
+ $this->assertEquals("The\012Test\012", io_readFile(__DIR__.'/io_readfile/test.txt.bz2'));
+ $this->assertEquals("The\015\012Test\015\012", io_readFile(__DIR__.'/io_readfile/test.txt.bz2', false));
+ $this->assertEquals(false, io_readFile(__DIR__.'/io_readfile/nope.txt.bz2'));
+ $this->assertEquals(false, io_readFile(__DIR__.'/io_readfile/corrupt.txt.bz2'));
+ }
+
+} \ No newline at end of file
diff --git a/_test/tests/inc/io_readfile/corrupt.txt.bz2 b/_test/tests/inc/io_readfile/corrupt.txt.bz2
new file mode 100644
index 000000000..97f742919
--- /dev/null
+++ b/_test/tests/inc/io_readfile/corrupt.txt.bz2
@@ -0,0 +1 @@
+BZh91AY&SYXHd¬ \ No newline at end of file
diff --git a/_test/tests/inc/io_readfile/corrupt.txt.gz b/_test/tests/inc/io_readfile/corrupt.txt.gz
new file mode 100644
index 000000000..9d7666f47
--- /dev/null
+++ b/_test/tests/inc/io_readfile/corrupt.txt.gz
Binary files differ
diff --git a/_test/tests/inc/io_readfile/test.txt.bz2 b/_test/tests/inc/io_readfile/test.txt.bz2
new file mode 100644
index 000000000..3d4e1b226
--- /dev/null
+++ b/_test/tests/inc/io_readfile/test.txt.bz2
Binary files differ
diff --git a/_test/tests/inc/io_readfile/test.txt.gz b/_test/tests/inc/io_readfile/test.txt.gz
new file mode 100644
index 000000000..8ac8f7d40
--- /dev/null
+++ b/_test/tests/inc/io_readfile/test.txt.gz
Binary files differ