summaryrefslogtreecommitdiff
path: root/ext/reflection/tests/ReflectionClassConstant_getValue.phpt
blob: 5ff0baf6e29adc7d2974877e7be8cb0c771d30d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
--TEST--
Test variations of getting constant values
--FILE--
<?php

/* Use separate classes to make sure that in-place constant updates don't interfere */
class A {
    const X = self::Y * 2;
    const Y = 1;
}
class B {
    const X = self::Y * 2;
    const Y = 1;
}
class C {
    const X = self::Y * 2;
    const Y = 1;
}

var_dump((new ReflectionClassConstant('A', 'X'))->getValue());
echo new ReflectionClassConstant('B', 'X');
echo new ReflectionClass('C');

?>
--EXPECTF--
int(2)
Constant [ public int X ] { 2 }
Class [ <user> class C ] {
  @@ %s 12-15

  - Constants [2] {
    Constant [ public int X ] { 2 }
    Constant [ public int Y ] { 1 }
  }

  - Static properties [0] {
  }

  - Static methods [0] {
  }

  - Properties [0] {
  }

  - Methods [0] {
  }
}