Skip to content

Commit 26dfce7

Browse files
villfapetk
authored andcommitted
Replace dirname(__FILE__) by __DIR__ in tests
1 parent 63802a8 commit 26dfce7

File tree

2,845 files changed

+5630
-5630
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,845 files changed

+5630
-5630
lines changed

Zend/tests/014.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ get_included_files() tests
55

66
var_dump(get_included_files());
77

8-
include(dirname(__FILE__)."/014.inc");
8+
include(__DIR__."/014.inc");
99
var_dump(get_included_files());
1010

1111
var_dump(get_included_files(1,1));
1212

13-
include_once(dirname(__FILE__)."/014.inc");
13+
include_once(__DIR__."/014.inc");
1414
var_dump(get_included_files());
1515

1616
var_dump(get_included_files(1));
1717

18-
include(dirname(__FILE__)."/014.inc");
18+
include(__DIR__."/014.inc");
1919
var_dump(get_included_files());
2020

2121
echo "Done\n";

Zend/tests/019.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ foreach ($array_variables as $array_var) {
151151

152152
echo "\n*** Testing unset(), empty() & isset() with resource variables ***\n";
153153
$fp = fopen(__FILE__, "r");
154-
$dfp = opendir( dirname(__FILE__) );
154+
$dfp = opendir( __DIR__ );
155155
$resources = array (
156156
$fp,
157157
$dfp

Zend/tests/bug21478.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class debugfilter extends php_user_filter {
1515

1616
stream_filter_register("myfilter","debugfilter");
1717

18-
$fp = fopen(dirname(__FILE__)."/test.txt","w");
18+
$fp = fopen(__DIR__."/test.txt","w");
1919
stream_filter_append($fp, "myfilter");
2020
stream_filter_append($fp, "myfilter");
2121
stream_filter_append($fp, "myfilter");
@@ -24,8 +24,8 @@ print "Done.\n";
2424
fclose($fp);
2525
// Uncommenting the following 'print' line causes the segfault to stop occurring
2626
// print "2\n";
27-
readfile(dirname(__FILE__)."/test.txt");
28-
unlink(dirname(__FILE__)."/test.txt");
27+
readfile(__DIR__."/test.txt");
28+
unlink(__DIR__."/test.txt");
2929
?>
3030
--EXPECT--
3131
Done.

Zend/tests/bug38779_1.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ class Loader {
2323
var_dump("flush!");
2424
}
2525
function stream_close() {
26-
@unlink(dirname(__FILE__)."/bug38779.txt");
26+
@unlink(__DIR__."/bug38779.txt");
2727
var_dump("close!");
2828
}
2929
}
3030
stream_wrapper_register('Loader', 'Loader');
3131
$fp = fopen ('Loader://qqq.php', 'r');
3232

33-
$filename = dirname(__FILE__)."/bug38779.txt";
33+
$filename = __DIR__."/bug38779.txt";
3434
$fp1 = fopen($filename, "w");
3535
fwrite($fp1, "<"."?php blah blah?".">");
3636
fclose($fp1);
@@ -42,9 +42,9 @@ echo "Done\n";
4242
--CLEAN--
4343
<?php
4444

45-
$filename = dirname(__FILE__)."/bug38779.txt";
45+
$filename = __DIR__."/bug38779.txt";
4646
if (file_exists($filename)) {
47-
@unlink(dirname(__FILE__)."/bug38779.txt");
47+
@unlink(__DIR__."/bug38779.txt");
4848
}
4949
?>
5050
--EXPECTF--

Zend/tests/bug39542.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ Bug #39542 (Behaviour of require_once/include_once different to < 5.2.0)
33
--FILE--
44
<?php
55
$oldcwd = getcwd();
6-
chdir(dirname(__FILE__));
6+
chdir(__DIR__);
77
if (substr(PHP_OS, 0, 3) == 'WIN') {
8-
set_include_path(dirname(__FILE__).'/bug39542;.');
8+
set_include_path(__DIR__.'/bug39542;.');
99
} else {
10-
set_include_path(dirname(__FILE__).'/bug39542:.');
10+
set_include_path(__DIR__.'/bug39542:.');
1111
}
1212

1313
spl_autoload_register(function ($class) {

Zend/tests/bug40236.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if (extension_loaded("readline")) die("skip Test doesn't support readline");
88
--FILE--
99
<?php
1010
$php = getenv('TEST_PHP_EXECUTABLE');
11-
$cmd = "\"$php\" -n -d memory_limit=4M -a \"".dirname(__FILE__)."\"/bug40236.inc";
11+
$cmd = "\"$php\" -n -d memory_limit=4M -a \"".__DIR__."\"/bug40236.inc";
1212
echo `$cmd`;
1313
?>
1414
--EXPECTF--

Zend/tests/bug52508.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Bug #52508 (newline problem with parse_ini_file+INI_SCANNER_RAW)
33
--FILE--
44
<?php
55

6-
$file = dirname(__FILE__) .'/bug52508.ini';
6+
$file = __DIR__ .'/bug52508.ini';
77

88
file_put_contents($file, "a = 1");
99

Zend/tests/bug63741.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Bug #63741 (Crash when autoloading from spl)
33
--FILE--
44
<?php
5-
file_put_contents(dirname(__FILE__)."/bug63741.tmp.php",
5+
file_put_contents(__DIR__."/bug63741.tmp.php",
66
<<<'EOT'
77
<?php
88
if (isset($autoloading))
@@ -41,10 +41,10 @@ else
4141
EOT
4242
);
4343

44-
include dirname(__FILE__)."/bug63741.tmp.php";
44+
include __DIR__."/bug63741.tmp.php";
4545
?>
4646
--CLEAN--
47-
<?php unlink(dirname(__FILE__)."/bug63741.tmp.php"); ?>
47+
<?php unlink(__DIR__."/bug63741.tmp.php"); ?>
4848
--EXPECT--
4949
autoloading...
5050
OK!

Zend/tests/class_constants_003.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class test {
1111
?>
1212
DATA;
1313

14-
$filename = dirname(__FILE__)."/cc003.dat";
14+
$filename = __DIR__."/cc003.dat";
1515
file_put_contents($filename, $class_data);
1616

1717
function foo($v = test::val) {

Zend/tests/globals_004.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ variables_order="egpcs"
66
<?php
77

88
function test() {
9-
include dirname(__FILE__)."/globals.inc";
9+
include __DIR__."/globals.inc";
1010
}
1111

1212
test();

Zend/tests/halt_compiler2.phpt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ __HALT_COMPILER(); 2 files
44
<?php
55
$text = "<?php echo 'test'; var_dump(__COMPILER_HALT_OFFSET__); __HALT_COMPILER(); ?>
66
hi there";
7-
file_put_contents(dirname(__FILE__) . '/test1.php', $text);
7+
file_put_contents(__DIR__ . '/test1.php', $text);
88
$text = "<?php echo 'test2'; var_dump(__COMPILER_HALT_OFFSET__); __HALT_COMPILER(); ?>
99
hi there 2";
10-
file_put_contents(dirname(__FILE__) . '/test2.php', $text);
11-
include dirname(__FILE__) . '/test1.php';
12-
include dirname(__FILE__) . '/test2.php';
10+
file_put_contents(__DIR__ . '/test2.php', $text);
11+
include __DIR__ . '/test1.php';
12+
include __DIR__ . '/test2.php';
1313
?>
1414
==DONE==
1515
--CLEAN--
1616
<?php
17-
unlink(dirname(__FILE__) . '/test1.php');
18-
unlink(dirname(__FILE__) . '/test2.php');
17+
unlink(__DIR__ . '/test1.php');
18+
unlink(__DIR__ . '/test2.php');
1919
?>
2020
--EXPECT--
2121
testint(73)

Zend/tests/runtime_compile_time_binary_operands.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ function prepareLine($op1, $op2, $cmp, $operator) {
122122
return $line;
123123
}
124124

125-
$filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'compare_binary_operands_temp.php';
125+
$filename = __DIR__ . DIRECTORY_SEPARATOR . 'compare_binary_operands_temp.php';
126126
$file = fopen($filename, "w");
127127

128128
fwrite($file, "<?php\n");
@@ -148,7 +148,7 @@ if($c === 0) {
148148
===DONE===
149149
--CLEAN--
150150
<?php
151-
$fl = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'compare_binary_operands_temp.php';
151+
$fl = __DIR__ . DIRECTORY_SEPARATOR . 'compare_binary_operands_temp.php';
152152
@unlink($fl);
153153
?>
154154
--EXPECT--

Zend/tests/unset_cv05.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ session.save_handler=files
66
--SKIPIF--
77
<?php
88

9-
include(dirname(__FILE__).'/../../ext/session/tests/skipif.inc');
9+
include(__DIR__.'/../../ext/session/tests/skipif.inc');
1010

1111
?>
1212
--FILE--

Zend/tests/unset_cv06.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
--TEST--
22
unset() CV 6 (indirect unset() of global variable in session_unset())
33
--SKIPIF--
4-
<?php include(dirname(__FILE__).'/../../ext/session/tests/skipif.inc'); ?>
4+
<?php include(__DIR__.'/../../ext/session/tests/skipif.inc'); ?>
55
--INI--
66
session.auto_start=0
77
session.save_handler=files

ext/bz2/tests/003-mb.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ bzread() tests
55
--FILE--
66
<?php
77

8-
$fd = bzopen(dirname(__FILE__)."/003私はガラスを食べられます.txt.bz2","r");
8+
$fd = bzopen(__DIR__."/003私はガラスを食べられます.txt.bz2","r");
99
var_dump(bzread());
1010
var_dump(bzread($fd, 1 ,0));
1111
var_dump(bzread($fd, 0));

ext/bz2/tests/003.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ bzread() tests
55
--FILE--
66
<?php
77

8-
$fd = bzopen(dirname(__FILE__)."/003.txt.bz2","r");
8+
$fd = bzopen(__DIR__."/003.txt.bz2","r");
99
var_dump(bzread());
1010
var_dump(bzread($fd, 1 ,0));
1111
var_dump(bzread($fd, 0));

ext/bz2/tests/004.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ bzread() tests with invalid files
55
--FILE--
66
<?php
77

8-
$fd = bzopen(dirname(__FILE__)."/004_1.txt.bz2","r");
8+
$fd = bzopen(__DIR__."/004_1.txt.bz2","r");
99
var_dump(bzerror($fd));
1010
var_dump(bzerrstr($fd));
1111
var_dump(bzerrno($fd));
1212

13-
$fd2 = bzopen(dirname(__FILE__)."/004_2.txt.bz2","r");
13+
$fd2 = bzopen(__DIR__."/004_2.txt.bz2","r");
1414
var_dump(bzerror($fd2));
1515
var_dump(bzerrstr($fd2));
1616
var_dump(bzerrno($fd2));

ext/bz2/tests/with_strings.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ $tests = <<<TESTS
2121
\$blaat === \$blaat2
2222
TESTS;
2323

24-
include(dirname(__FILE__) . '/../../../tests/quicktester.inc');
24+
include(__DIR__ . '/../../../tests/quicktester.inc');
2525
--EXPECT--
2626
OK

ext/com_dotnet/tests/bug66431_0.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if (!extension_loaded("com_dotnet")){ echo "skip COM/.Net support not present";
88
<?php
99

1010
$text= "Xin chào cộng đồng PHP";
11-
$fpath = str_replace("/", "\\", dirname(__FILE__) . "/bug66431.txt");
11+
$fpath = str_replace("/", "\\", __DIR__ . "/bug66431.txt");
1212

1313
$fso = new COM("Scripting.FileSystemObject");
1414
$fh = $fso->OpenTextFile($fpath, 2, true);
@@ -31,7 +31,7 @@ if (!$result) {
3131
--CLEAN--
3232
<?php
3333

34-
$fpath = str_replace("/", "\\", dirname(__FILE__) . "/bug66431.txt");
34+
$fpath = str_replace("/", "\\", __DIR__ . "/bug66431.txt");
3535

3636
if (file_exists($fpath)) {
3737
unlink($fpath);

ext/com_dotnet/tests/bug66431_1.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ try {
1515
<?php
1616

1717
$text= "Xin chào cộng đồng PHP";
18-
$fpath = str_replace("/", "\\", dirname(__FILE__) . "/bug66431.docx");
18+
$fpath = str_replace("/", "\\", __DIR__ . "/bug66431.docx");
1919

2020
com_load_typelib('Word.Application');
2121

@@ -49,7 +49,7 @@ if (!$result) {
4949
--CLEAN--
5050
<?php
5151

52-
$fpath = str_replace("/", "\\", dirname(__FILE__) . "/bug66431.docx");
52+
$fpath = str_replace("/", "\\", __DIR__ . "/bug66431.docx");
5353

5454
if (file_exists($fpath)) {
5555
unlink($fpath);

ext/curl/tests/bug48203.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Bug #48203 (Crash when CURLOPT_STDERR is set to regular file)
55
--FILE--
66
<?php
77
include 'server.inc';
8-
$fp = fopen(dirname(__FILE__) . '/bug48203.tmp', 'w');
8+
$fp = fopen(__DIR__ . '/bug48203.tmp', 'w');
99

1010
$ch = curl_init();
1111

@@ -22,7 +22,7 @@ echo "Ok\n";
2222

2323
?>
2424
--CLEAN--
25-
<?php @unlink(dirname(__FILE__) . '/bug48203.tmp'); ?>
25+
<?php @unlink(__DIR__ . '/bug48203.tmp'); ?>
2626
--EXPECTF--
2727
Warning: curl_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %s on line %d
2828
%A

ext/curl/tests/bug48203_multi.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ include 'skipif.inc';
88
<?php
99
include 'server.inc';
1010
function checkForClosedFilePointer($target_url, $curl_option, $description) {
11-
$fp = fopen(dirname(__FILE__) . '/bug48203.tmp', 'w');
11+
$fp = fopen(__DIR__ . '/bug48203.tmp', 'w');
1212

1313
$ch1 = curl_init();
1414
$ch2 = curl_init();
@@ -65,7 +65,7 @@ foreach($options_to_check as $option) {
6565

6666
?>
6767
--CLEAN--
68-
<?php @unlink(dirname(__FILE__) . '/bug48203.tmp'); ?>
68+
<?php @unlink(__DIR__ . '/bug48203.tmp'); ?>
6969
--EXPECTF--
7070
Warning: curl_multi_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %s on line %d
7171

ext/curl/tests/bug54798-unix.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if(substr(PHP_OS, 0, 3) == 'WIN' ) {
1111
<?php
1212

1313
function checkForClosedFilePointer($host, $curl_option, $description) {
14-
$fp = fopen(dirname(__FILE__) . '/bug54798.tmp', 'w+');
14+
$fp = fopen(__DIR__ . '/bug54798.tmp', 'w+');
1515

1616
$ch = curl_init();
1717

@@ -54,7 +54,7 @@ foreach($options_to_check as $option) {
5454
?>
5555
===DONE===
5656
--CLEAN--
57-
<?php @unlink(dirname(__FILE__) . '/bug54798.tmp'); ?>
57+
<?php @unlink(__DIR__ . '/bug54798.tmp'); ?>
5858
--EXPECTF--
5959
%a
6060
%aOk for CURLOPT_STDERR

ext/curl/tests/bug54798.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ include 'skipif.inc';
88
<?php
99

1010
function checkForClosedFilePointer($host, $curl_option, $description) {
11-
$fp = fopen(dirname(__FILE__) . '/bug54798.tmp', 'w+');
11+
$fp = fopen(__DIR__ . '/bug54798.tmp', 'w+');
1212

1313
$ch = curl_init();
1414

@@ -51,7 +51,7 @@ foreach($options_to_check as $option) {
5151
?>
5252
===DONE===
5353
--CLEAN--
54-
<?php @unlink(dirname(__FILE__) . '/bug54798.tmp'); ?>
54+
<?php @unlink(__DIR__ . '/bug54798.tmp'); ?>
5555
--EXPECTF--
5656
%AOk for CURLOPT_STDERR
5757

ext/curl/tests/bug61948.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Bug #61948 (CURLOPT_COOKIEFILE '' raises open_basedir restriction)
55
?>
66
--FILE--
77
<?php
8-
$base_dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug61948";
8+
$base_dir = __DIR__ . DIRECTORY_SEPARATOR . "bug61948";
99
mkdir($base_dir . DIRECTORY_SEPARATOR . "foo", 0755, true);
1010

1111
ini_set("open_basedir", $base_dir);
@@ -18,7 +18,7 @@ Bug #61948 (CURLOPT_COOKIEFILE '' raises open_basedir restriction)
1818
?>
1919
--CLEAN--
2020
<?php
21-
$base_dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug61948";
21+
$base_dir = __DIR__ . DIRECTORY_SEPARATOR . "bug61948";
2222
rmdir("$base_dir/foo");
2323
rmdir($base_dir);
2424
?>

ext/curl/tests/bug67643.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if (!extension_loaded('curl')) print 'skip';
77
--FILE--
88
<?php
99
$ch = curl_init();
10-
curl_setopt($ch, CURLOPT_URL, 'file://'. dirname(__FILE__) . DIRECTORY_SEPARATOR .'curl_testdata1.txt');
10+
curl_setopt($ch, CURLOPT_URL, 'file://'. __DIR__ . DIRECTORY_SEPARATOR .'curl_testdata1.txt');
1111
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
1212

1313
$mh = curl_multi_init();

0 commit comments

Comments
 (0)