From c8319c784267f81e2884a076365b8ca36f4ce0b2 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Tue, 19 Jun 2018 23:11:45 +0200 Subject: remove unused $context in it::fopen (null not allowed), add and fix tests --- it.class | 4 ++-- tests/it.t | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/it.class b/it.class index a129c09..8b443dc 100644 --- a/it.class +++ b/it.class @@ -1180,9 +1180,9 @@ static function file_put_contents($filename, $data, $flags = 0, $resource = null return file_put_contents(it::safe_filename($filename), $data, $flags, $resource); } -static function fopen($filename, $mode, $use_include_path = false, $context = null) +static function fopen($filename, $mode, $use_include_path = false) { - return fopen(it::safe_filename($filename), $mode, $use_include_path, $context); + return fopen(it::safe_filename($filename), $mode, $use_include_path); } static function file($filename, $flags = 0, $context = null) diff --git a/tests/it.t b/tests/it.t index 08640cf..bab6685 100755 --- a/tests/it.t +++ b/tests/it.t @@ -463,9 +463,12 @@ is(it::split("(b)", "aba", ['delim_capture' => true]), ["a", "b", "a"]); is(it::split("b", "aabaa", ['offset_capture' => true]), [["aa", 0], ["aa", 3]]); it::file_put_contents("/tmp/it_test", "aa"); -is(($fh = fopen("/tmp/it_test", "r")) ? fgets($fh) : null, "aa"); +is(($fh = it::fopen("/tmp/it_test", "r")) ? fgets($fh) : null, "aa"); is(it::file_get_contents("/tmp/it_test"), "aa"); is(it::file("/tmp/it_test"), ["aa"]); +ob_start(); +it::readfile("/tmp/it_test"); +is(ob_get_clean(), "aa"); it::file_put("/tmp/it_test", "bb"); is(it::file_get("/tmp/it_test"), "bb"); -- cgit v1.2.3