From 2b13737e9299317c865f72f4a276ea0b733c4f5f Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Mon, 2 Sep 2019 17:14:43 +0200 Subject: Make itools a bit stricter, new PHP versions start to enforce more declarations --- test/it.t | 3 ++- test/it_html.t | 4 ++-- test/it_xml.t | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/it.t b/test/it.t index b624f96..0e2b06d 100755 --- a/test/it.t +++ b/test/it.t @@ -445,7 +445,8 @@ is(it::map('5*$k+$v', array(0 => 1, 1 => 2)), array(1, 7)); is(it::map(function($k, $v) {return 5*$k+$v;}, array(0 => 1, 1 => 2)), array(1, 7)); is(it::map('strlen', array("aaa", "aa")), array(3, 2)); is(it::map('it::ucfirst', array("aaa")), array("Aaa")); -is(it::map('$v->C14N()', DOMDocument::loadXML('42')->childNodes), [ '42' ], "Traversable: Needs copy, not modifiable in-place"); +($dom = new DOMDocument)->loadXML('42'); +is(it::map('$v->C14N()', $dom->childNodes), [ '42' ], "Traversable: Needs copy, not modifiable in-place"); # Special values which are not callable is(it::map('null', array("aaa", "aa")), array(null, null)); is(it::map('1', array("aaa", "aa")), array(1, 1)); diff --git a/test/it_html.t b/test/it_html.t index 5e19b74..f5daebd 100755 --- a/test/it_html.t +++ b/test/it_html.t @@ -175,7 +175,7 @@ is( class myhtml extends it_html { -function myhtml($p = array()) +function __construct($p = array()) { parent::__construct($p + ['moretags' => 'overriddentag,defaulttag', 'nonewlinetags' => 'a,b,defaulttag,em,img,input,overriddentag,span,div']); } @@ -253,7 +253,7 @@ is( 'empty tags removal' ); -foreach (json_decode(file_get_contents(dirname($argv[0]) . '/U_tests.json'), true) as $test) { +foreach (json_decode(it::file_get_contents(dirname($argv[0]) . '/U_tests.json'), true) as $test) { is(U(...$test['args']), $test['exp'], $test['name']); } diff --git a/test/it_xml.t b/test/it_xml.t index 4df340a..84f258f 100755 --- a/test/it_xml.t +++ b/test/it_xml.t @@ -95,7 +95,7 @@ match( class my_xml extends it_xml { -function my_xml($xmldata) +function __construct($xmldata) { parent::__construct($xmldata); -- cgit v1.2.3