Skip to content

Commit d614876

Browse files
committed
ext/phar: applied fixers to improve test robustness
1 parent e879459 commit d614876

163 files changed

Lines changed: 513 additions & 565 deletions

File tree

Some content is hidden

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

ext/phar/tests/002.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ phar
77
try {
88
Phar::mapPhar(5, 'hio', 'hi');
99
} catch (TypeError $e) {
10-
echo $e->getMessage(), "\n";
10+
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
1111
}
1212

1313
try {
1414
Phar::mapPhar();
1515
} catch (Exception $e) {
16-
echo $e->getMessage(), "\n";
16+
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
1717
}
1818
__HALT_COMPILER(); ?>
1919
--EXPECTF--
20-
Phar::mapPhar() expects at most 2 arguments, 3 given
21-
internal corruption of phar "%s002.php" (truncated manifest at manifest length)
20+
ArgumentCountError: Phar::mapPhar() expects at most 2 arguments, 3 given
21+
PharException: internal corruption of phar "%s002.php" (truncated manifest at manifest length)

ext/phar/tests/004.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ phar
77
try {
88
Phar::mapPhar('hio');
99
} catch (Exception $e) {
10-
echo $e->getMessage();
10+
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
1111
}
1212
?>
1313
--EXPECT--
14-
__HALT_COMPILER(); must be declared in a phar
14+
PharException: __HALT_COMPILER(); must be declared in a phar

ext/phar/tests/005.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ phar
77
try {
88
Phar::mapPhar('hio');
99
} catch (Exception $e) {
10-
echo $e->getMessage();
10+
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
1111
}
1212
__HALT_COMPILER(); ?>()
1313
--EXPECTF--
14-
internal corruption of phar "%s" (truncated manifest at manifest length)
14+
PharException: internal corruption of phar "%s" (truncated manifest at manifest length)

ext/phar/tests/006.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ phar
77
try {
88
Phar::mapPhar('hio');
99
} catch (Exception $e) {
10-
echo $e->getMessage();
10+
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
1111
}
1212
__HALT_COMPILER(); ?>
1313
--EXPECTF--
14-
internal corruption of phar "%s" (truncated manifest at manifest length)
14+
PharException: internal corruption of phar "%s" (truncated manifest at manifest length)

ext/phar/tests/007.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ phar
77
try {
88
Phar::mapPhar('hio');
99
} catch (Exception $e) {
10-
echo $e->getMessage();
10+
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
1111
}
1212
__HALT_COMPILER(); ?>~~~~
1313
--EXPECTF--
14-
manifest cannot be larger than 100 MB in phar "%s"
14+
PharException: manifest cannot be larger than 100 MB in phar "%s"

ext/phar/tests/008.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ file_put_contents(__DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php', $fil
1212
try {
1313
include __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';
1414
} catch (Exception $e) {
15-
echo $e->getMessage();
15+
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
1616
}
1717
?>
1818
--CLEAN--
1919
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
2020
--EXPECTF--
21-
internal corruption of phar "%s" (truncated manifest header)
21+
PharException: internal corruption of phar "%s" (truncated manifest header)

ext/phar/tests/009.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ file_put_contents(__DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php', $fil
1414
try {
1515
include __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';
1616
} catch (Exception $e) {
17-
echo $e->getMessage();
17+
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
1818
}
1919
?>
2020
--CLEAN--
2121
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
2222
--EXPECTF--
23-
internal corruption of phar "%s009.phar.php" (too many manifest entries for size of manifest)
23+
PharException: internal corruption of phar "%s009.phar.php" (too many manifest entries for size of manifest)

ext/phar/tests/010.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ try {
2020
include __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';
2121
echo file_get_contents('phar://hio/a');
2222
} catch (Exception $e) {
23-
echo $e->getMessage();
23+
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
2424
}
2525
?>
2626
--CLEAN--
2727
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
2828
--EXPECTF--
29-
internal corruption of phar "%s" (too many manifest entries for size of manifest)
29+
PharException: internal corruption of phar "%s" (too many manifest entries for size of manifest)

ext/phar/tests/011.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ try {
2121
include $fname;
2222
echo file_get_contents('phar://hio/a');
2323
} catch (Exception $e) {
24-
echo $e->getMessage();
24+
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
2525
}
2626
?>
2727
--CLEAN--
2828
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
2929
--EXPECTF--
30-
internal corruption of phar "%s" (compressed and uncompressed size does not match for uncompressed entry)
30+
PharException: internal corruption of phar "%s" (compressed and uncompressed size does not match for uncompressed entry)

ext/phar/tests/029.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ try
3333
}
3434
catch (Exception $e)
3535
{
36-
echo $e->getMessage() . "\n";
36+
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
3737
}
3838

3939
?>
@@ -45,4 +45,4 @@ unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.2.phar.php');
4545
--EXPECTF--
4646
bool(true)
4747
bool(true)
48-
alias "copy" is already used for archive "%s029.1.phar.php" cannot be overloaded with "%s029.2.phar.php"
48+
PharException: alias "copy" is already used for archive "%s029.1.phar.php" cannot be overloaded with "%s029.2.phar.php"

0 commit comments

Comments
 (0)