test(namespace): extend global constant import coverage

master
韩天峰 4 hours ago
parent d86d3f431d
commit 3452ddfd6e
  1. 21
      tests/compiler/namespace/use-const-single-segment.phpt

@ -1,9 +1,11 @@
--TEST--
use const with a single-segment (global) constant name
use const with single-segment global names, aliases, and runtime constants
--FILE--
<?php
namespace App {
use const PHP_EOL;
use const PHP_EOL as LINE_END;
use const TYPEPHP_RUNTIME_SINGLE_SEGMENT as RUNTIME_VALUE;
const ANSWER = 42;
@ -11,6 +13,16 @@ namespace App {
{
return "hello" . PHP_EOL;
}
function helloAlias(): string
{
return "alias" . LINE_END;
}
function runtimeValue(): string
{
return RUNTIME_VALUE;
}
}
namespace {
@ -19,10 +31,17 @@ namespace {
function main(): void
{
echo \App\hello();
echo \App\helloAlias();
echo ANSWER, "\n";
define('TYPEPHP_RUNTIME_SINGLE_SEGMENT', 'runtime-value');
define('RUNTIME_VALUE', 'wrong-alias-fallback');
echo \App\runtimeValue(), "\n";
}
}
?>
--EXPECT--
hello
alias
42
runtime-value

Loading…
Cancel
Save