From: Kalle Sommer Nielsen Date: Sun, 30 Sep 2018 08:41:34 +0000 (+0200) Subject: Fix some tests and improve coverage for Windows in SPL X-Git-Tag: php-7.4.0alpha1~1803^2~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8595dc8fa93237565217e7d8d42e7e79dcd427e7;p=php Fix some tests and improve coverage for Windows in SPL --- diff --git a/ext/spl/tests/DirectoryIterator_getExtension_basic.phpt b/ext/spl/tests/DirectoryIterator_getExtension_basic.phpt index a35a524f35..e356e2a017 100644 --- a/ext/spl/tests/DirectoryIterator_getExtension_basic.phpt +++ b/ext/spl/tests/DirectoryIterator_getExtension_basic.phpt @@ -1,29 +1,26 @@ --TEST-- SPL: DirectoryIterator::getExtension() basic test ---SKIPIF-- - --FILE-- getFilename(), $skip)) { + if ($file->isDot()) { continue; } + $dit_exts[] = $file->getExtension(); $nfo_exts[] = pathinfo($file->getFilename(), PATHINFO_EXTENSION); } @@ -34,7 +31,7 @@ var_dump($dit_exts); --CLEAN-- --EXPECT-- bool(true) -array(5) { +array(3) { [0]=> string(0) "" [1]=> - string(0) "" - [2]=> - string(0) "" - [3]=> string(9) "extension" - [4]=> + [2]=> string(3) "txt" } diff --git a/ext/spl/tests/DirectoryIterator_getGroup_basic.phpt b/ext/spl/tests/DirectoryIterator_getGroup_basic.phpt index 81ab6c0921..74586b7e0f 100644 --- a/ext/spl/tests/DirectoryIterator_getGroup_basic.phpt +++ b/ext/spl/tests/DirectoryIterator_getGroup_basic.phpt @@ -2,7 +2,8 @@ SPL: DirectoryIterator test getGroup --SKIPIF-- Andrea Giorgini diff --git a/ext/spl/tests/DirectoryIterator_getInode_basic.phpt b/ext/spl/tests/DirectoryIterator_getInode_basic.phpt index a6b128a222..95d20881bc 100644 --- a/ext/spl/tests/DirectoryIterator_getInode_basic.phpt +++ b/ext/spl/tests/DirectoryIterator_getInode_basic.phpt @@ -10,7 +10,7 @@ Jacopo Romei #Test Fest Cesena (Italy) on 2009-06-20 --SKIPIF-- --FILE-- #Test Fest Cesena (Italy) on 2009-06-20 --SKIPIF-- --FILE-- Andrea Giorgini diff --git a/ext/spl/tests/bug68825.phpt b/ext/spl/tests/bug68825.phpt index b1ed5fb60f..6bc03cb734 100644 --- a/ext/spl/tests/bug68825.phpt +++ b/ext/spl/tests/bug68825.phpt @@ -3,12 +3,16 @@ Bug #68825 (Exception in DirectoryIterator::getLinkTarget()) --FILE-- getFilename()) { + if ('bug' === $entry->getFilename()) { var_dump($entry->getLinkTarget()); } } @@ -20,6 +24,6 @@ string(%d) "%s%eext%espl%etests%ebug68825.php" --CLEAN-- diff --git a/ext/spl/tests/fileobject_001.phpt b/ext/spl/tests/fileobject_001.phpt index 61f688d79f..35a5156401 100644 --- a/ext/spl/tests/fileobject_001.phpt +++ b/ext/spl/tests/fileobject_001.phpt @@ -40,12 +40,12 @@ foreach($o as $n => $l) ?> ===DONE=== ---EXPECT-- +--EXPECTF-- int(0) -string(2) "0 +string(%d) "0 " int(0) -string(2) "0 +string(%d) "0 " int(0) int(1) diff --git a/ext/spl/tests/fileobject_002.phpt b/ext/spl/tests/fileobject_002.phpt index 8031e98fdc..1f7e4eaf14 100644 --- a/ext/spl/tests/fileobject_002.phpt +++ b/ext/spl/tests/fileobject_002.phpt @@ -12,6 +12,10 @@ function test($name) var_dump($o->key()); while(($c = $o->fgetc()) !== false) { + // Kinda ugly but works around new lines mess + if ($c === "\r") { + continue; + } var_dump($o->key(), $c, $o->eof()); } echo "===EOF?===\n";