Skip to content

submitting tests from TestFest #116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
--TEST--
RecursiveDirectoryIterator::getBasePath() - basic test
--CREDITS--
Pawel Krynicki <pawel [dot] krynicki [at] xsolve [dot] pl>
#testfest AmsterdamPHP 2012-06-23
--FILE--
<?php
$depth0 = md5('recursiveDirectoryIterator::getSubPath');
$depth1 = md5('depth1');
$depth2 = md5('depth2');
$targetDir = __DIR__.DIRECTORY_SEPARATOR.$depth0.DIRECTORY_SEPARATOR.$depth1.DIRECTORY_SEPARATOR.$depth2;
mkdir($targetDir, 0777, true);
touch($targetDir.DIRECTORY_SEPARATOR.'getSubPath_test.tmp');
$iterator = new RecursiveDirectoryIterator(__DIR__.DIRECTORY_SEPARATOR.$depth0);
$it = new RecursiveIteratorIterator($iterator);

while($it->valid())
{
echo $it->getSubPath()."\n";
$it->next();
}
?>
--CLEAN--
<?php
function rrmdir($dir)
{
foreach(glob($dir . '/*') as $file)
{
if(is_dir($file))
{
rrmdir($file);
}
else
{
unlink($file);
}
}

rmdir($dir);
}

$targetDir = __DIR__.DIRECTORY_SEPARATOR.md5('recursiveDirectoryIterator::getSubPath');
rrmdir($targetDir);
?>

--EXPECT--
a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test fails. Actual output produced is:

a0c967a6c2c34786e4802f59af9356f5
a0c967a6c2c34786e4802f59af9356f5
a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507
a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507
a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507

a0c967a6c2c34786e4802f59af9356f5
55 changes: 55 additions & 0 deletions ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
--TEST--
RecursiveDirectoryIterator::getBasePathname() - basic test
--CREDITS--
Pawel Krynicki <pawel [dot] krynicki [at] xsolve [dot] pl>
#testfest AmsterdamPHP 2012-06-23
--FILE--
<?php
$depth0 = md5('recursiveDirectoryIterator::getSubPathname');
$depth1 = md5('depth1');
$depth2 = md5('depth2');
$targetDir = __DIR__.DIRECTORY_SEPARATOR.$depth0.DIRECTORY_SEPARATOR.$depth1.DIRECTORY_SEPARATOR.$depth2;
mkdir($targetDir, 0777, true);
touch($targetDir.DIRECTORY_SEPARATOR.'getSubPathname_test_2.tmp');
touch(__DIR__.DIRECTORY_SEPARATOR.$depth0.DIRECTORY_SEPARATOR.$depth1.DIRECTORY_SEPARATOR.'getSubPathname_test_3.tmp');
touch(__DIR__.DIRECTORY_SEPARATOR.$depth0.DIRECTORY_SEPARATOR.'getSubPathname_test_1.tmp');
$iterator = new RecursiveDirectoryIterator(__DIR__.DIRECTORY_SEPARATOR.$depth0);
$it = new RecursiveIteratorIterator($iterator);

while($it->valid())
{
echo $it->getSubPathname()."\n";
$it->next();
}
?>
--CLEAN--
<?php
function rrmdir($dir)
{
foreach(glob($dir . '/*') as $file)
{
if(is_dir($file))
{
rrmdir($file);
}
else
{
unlink($file);
}
}

rmdir($dir);
}

$targetDir = __DIR__.DIRECTORY_SEPARATOR.md5('recursiveDirectoryIterator::getSubPathname');
rrmdir($targetDir);
?>

--EXPECT--
..
..
getSubPathname_test_1.tmp
.
a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507/getSubPathname_test_2.tmp
a0c967a6c2c34786e4802f59af9356f5/.
a0c967a6c2c34786e4802f59af9356f5/getSubPathname_test_3.tmp
13 changes: 13 additions & 0 deletions ext/standard/tests/strings/http_build_query_error.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--TEST--
Testing error on null parameter 1 of http_build_query()
--CREDITS--
Pawel Krynicki <pawel.krynicki [at] xsolve [dot] pl>
#testfest AmsterdamPHP 2012-06-23
--FILE--
<?php

$result = http_build_query(null);

?>
--EXPECTF--
Warning: http_build_query(): Parameter 1 expected to be Array or Object. %s value given in %s on line %d