Skip to content

Commit e2f7a9f

Browse files
committed
Add tests for skipping the file/directory that would otherwise form the fileuri content
1 parent 7e52305 commit e2f7a9f

9 files changed

Lines changed: 130 additions & 5 deletions

tests/debugger/maps/map-single-file/.xdebug/simple.map

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@
22
./file-uri-file1.inc = /var/www/projects/xdebug-test/fake-local-file1.php
33
./file-uri-file2.inc:1 = /var/www/projects/xdebug-test/fake-local-file2.php:1
44
./file-uri-file2.inc:2-99999 = /var/www/projects/xdebug-test/fake-local-file2.php:3-100000
5+
./file-uri-file3.inc = SKIP
6+
./file-uri-file4.inc:1 = SKIP
7+
./file-uri-file4.inc:2-99999 = SKIP
8+
./file-uri-dir/ = SKIP

tests/debugger/maps/map-single-file/bug02374.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ check_reqs('dbgp');
1010
require __DIR__ . '/../../dbgp/dbgpclient.php';
1111
$filename = dirname(__FILE__) . '/dbgp-breakpoint-line.inc';
1212

13-
$xdebugLogFileName = sys_get_temp_dir() . '/' . getenv('UNIQ_RUN_ID') . getenv('TEST_PHP_WORKER') . 'start_ignore_yes_env.txt';
13+
$xdebugLogFileName = sys_get_temp_dir() . '/' . getenv('UNIQ_RUN_ID') . getenv('TEST_PHP_WORKER') . 'bug02374.txt';
1414
@unlink( $xdebugLogFileName );
1515

1616
$commands = array(

tests/debugger/maps/map-single-file/dbgp-breakpoint-line.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ check_reqs('dbgp');
1010
require __DIR__ . '/../../dbgp/dbgpclient.php';
1111
$filename = dirname(__FILE__) . '/dbgp-breakpoint-line.inc';
1212

13-
$xdebugLogFileName = sys_get_temp_dir() . '/' . getenv('UNIQ_RUN_ID') . getenv('TEST_PHP_WORKER') . 'start_ignore_yes_env.txt';
13+
$xdebugLogFileName = sys_get_temp_dir() . '/' . getenv('UNIQ_RUN_ID') . getenv('TEST_PHP_WORKER') . 'dbgp-breakpoint-line.txt';
1414
@unlink( $xdebugLogFileName );
1515

1616
$commands = array(
@@ -42,7 +42,7 @@ echo file_get_contents( $xdebugLogFileName );
4242
[%d] [Path Mapping] DEBUG: No map files found with pattern '%sdebugger%emaps%e.xdebug%e*.map'
4343
[%d] [Path Mapping] INFO: Scanning for map files with pattern '%sdebugger%emaps%emap-single-file%e.xdebug%e*.map'
4444
[%d] [Path Mapping] INFO: Reading mapping file '%sdebugger%emaps%emap-single-file%e.xdebug%esimple.map'
45-
[%d] [Path Mapping] DEBUG: Found 3 path mapping rules
45+
[%d] [Path Mapping] DEBUG: Found %d path mapping rules
4646
%A
4747
[%d] [Step Debug] <- breakpoint_set -i 3 -t line -f /var/www/projects/xdebug-test/fake-local-file.php -n 3
4848
[%d] [Path Mapping] INFO: Mapping (to replace) local location /var/www/projects/xdebug-test/fake-local-file.php:3
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
--TEST--
2+
DBGP: fileuri with directory skipped path map
3+
--SKIPIF--
4+
<?php
5+
require __DIR__ . '/../../../utils.inc';
6+
check_reqs('dbgp');
7+
?>
8+
--FILE--
9+
<?php
10+
require __DIR__ . '/../../dbgp/dbgpclient.php';
11+
$filename = dirname(__FILE__) . '/file-uri-dir/file.inc';
12+
13+
$xdebugLogFileName = sys_get_temp_dir() . '/' . getenv('UNIQ_RUN_ID') . getenv('TEST_PHP_WORKER') . 'dbgp-fileuri-dir-skip-map.txt';
14+
@unlink( $xdebugLogFileName );
15+
16+
$commands = array(
17+
'feature_set -n breakpoint_details -v 1',
18+
'detach',
19+
);
20+
21+
dbgpRunFile(
22+
$filename, $commands,
23+
[
24+
'xdebug.mode' => 'debug', 'xdebug.start_with_request' => 'yes',
25+
'xdebug.log' => $xdebugLogFileName, 'xdebug.log_level' => 10,
26+
'xdebug.path_mapping' => 'yes',
27+
],
28+
[
29+
'SanitizeFileUri' => false,
30+
],
31+
);
32+
33+
echo file_get_contents( $xdebugLogFileName );
34+
@unlink( $xdebugLogFileName );
35+
?>
36+
--EXPECTF--
37+
<?xml version="1.0" encoding="iso-8859-1"?>
38+
<init %s fileuri="%sfile.inc" %s></init>
39+
%A

tests/debugger/maps/map-single-file/dbgp-fileuri-file-map.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ check_reqs('dbgp');
1010
require __DIR__ . '/../../dbgp/dbgpclient.php';
1111
$filename = dirname(__FILE__) . '/file-uri-file1.inc';
1212

13-
$xdebugLogFileName = sys_get_temp_dir() . '/' . getenv('UNIQ_RUN_ID') . getenv('TEST_PHP_WORKER') . 'start_ignore_yes_env.txt';
13+
$xdebugLogFileName = sys_get_temp_dir() . '/' . getenv('UNIQ_RUN_ID') . getenv('TEST_PHP_WORKER') . 'dbgp-fileuri-file-map.txt';
1414
@unlink( $xdebugLogFileName );
1515

1616
$commands = array(
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
--TEST--
2+
DBGP: fileuri with full skipped file path map
3+
--SKIPIF--
4+
<?php
5+
require __DIR__ . '/../../../utils.inc';
6+
check_reqs('dbgp');
7+
?>
8+
--FILE--
9+
<?php
10+
require __DIR__ . '/../../dbgp/dbgpclient.php';
11+
$filename = dirname(__FILE__) . '/file-uri-file3.inc';
12+
13+
$xdebugLogFileName = sys_get_temp_dir() . '/' . getenv('UNIQ_RUN_ID') . getenv('TEST_PHP_WORKER') . 'dbgp-fileuri-file-skip-map.txt';
14+
@unlink( $xdebugLogFileName );
15+
16+
$commands = array(
17+
'feature_set -n breakpoint_details -v 1',
18+
'detach',
19+
);
20+
21+
dbgpRunFile(
22+
$filename, $commands,
23+
[
24+
'xdebug.mode' => 'debug', 'xdebug.start_with_request' => 'yes',
25+
'xdebug.log' => $xdebugLogFileName, 'xdebug.log_level' => 10,
26+
'xdebug.path_mapping' => 'yes',
27+
],
28+
[
29+
'SanitizeFileUri' => false,
30+
],
31+
);
32+
33+
echo file_get_contents( $xdebugLogFileName );
34+
@unlink( $xdebugLogFileName );
35+
?>
36+
--EXPECTF--
37+
<?xml version="1.0" encoding="iso-8859-1"?>
38+
<init %s fileuri="%sfile-uri-file3.inc" %s></init>
39+
%A

tests/debugger/maps/map-single-file/dbgp-fileuri-lines-map.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ check_reqs('dbgp');
1010
require __DIR__ . '/../../dbgp/dbgpclient.php';
1111
$filename = dirname(__FILE__) . '/file-uri-file2.inc';
1212

13-
$xdebugLogFileName = sys_get_temp_dir() . '/' . getenv('UNIQ_RUN_ID') . getenv('TEST_PHP_WORKER') . 'start_ignore_yes_env.txt';
13+
$xdebugLogFileName = sys_get_temp_dir() . '/' . getenv('UNIQ_RUN_ID') . getenv('TEST_PHP_WORKER') . 'dbgp-fileuri-lines-map.txt';
1414
@unlink( $xdebugLogFileName );
1515

1616
$commands = array(
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
--TEST--
2+
DBGP: fileuri with multiple skipped lines path map
3+
--SKIPIF--
4+
<?php
5+
require __DIR__ . '/../../../utils.inc';
6+
check_reqs('dbgp');
7+
?>
8+
--FILE--
9+
<?php
10+
require __DIR__ . '/../../dbgp/dbgpclient.php';
11+
$filename = dirname(__FILE__) . '/file-uri-file1.inc';
12+
13+
$xdebugLogFileName = sys_get_temp_dir() . '/' . getenv('UNIQ_RUN_ID') . getenv('TEST_PHP_WORKER') . 'dbgp-fileuri-lines-skip-map.txt';
14+
@unlink( $xdebugLogFileName );
15+
16+
$commands = array(
17+
'feature_set -n breakpoint_details -v 1',
18+
'detach',
19+
);
20+
21+
dbgpRunFile(
22+
$filename, $commands,
23+
[
24+
'xdebug.mode' => 'debug', 'xdebug.start_with_request' => 'yes',
25+
'xdebug.log' => $xdebugLogFileName, 'xdebug.log_level' => 10,
26+
'xdebug.path_mapping' => 'yes',
27+
],
28+
[
29+
'SanitizeFileUri' => false,
30+
],
31+
);
32+
33+
echo file_get_contents( $xdebugLogFileName );
34+
@unlink( $xdebugLogFileName );
35+
?>
36+
--EXPECTF--
37+
<?xml version="1.0" encoding="iso-8859-1"?>
38+
<init %s fileuri="file:///var/www/projects/xdebug-test/fake-local-file1.php" %s></init>
39+
%A
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?php
2+
define("YES", M_PI); $NO = 42;
3+
echo "hi\n";
4+
?>

0 commit comments

Comments
 (0)