Skip to content

Commit 92960ad

Browse files
committed
Add testcases
1 parent b410ad5 commit 92960ad

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

Zend/tests/traits/constant_017.phpt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--TEST--
2+
Referencing trait constants directly on calling \defined() returns false
3+
--FILE--
4+
<?php
5+
6+
trait TestTrait {
7+
public const Constant = 42;
8+
}
9+
10+
var_dump(\defined('TestTrait::Constant'));
11+
?>
12+
--EXPECTF--
13+
bool(false)

Zend/tests/traits/constant_018.phpt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
Referencing trait constants directly on calling \constant() causes a fatal error
3+
--FILE--
4+
<?php
5+
6+
trait TestTrait {
7+
public const Constant = 42;
8+
}
9+
10+
var_dump(\constant('TestTrait::Constant'));
11+
?>
12+
--EXPECTF--
13+
Fatal error: Uncaught Error: Cannot access trait constant TestTrait::Constant directly in %s:%d
14+
Stack trace:
15+
#0 %s: constant('TestTrait::Cons...')
16+
#1 {main}
17+
thrown in %s on line %d

0 commit comments

Comments
 (0)