Browse Source

Lets test access to derived attributes.

release/v0.1
Rafal Kupiec 1 year ago
parent
commit
3689a0239a
Signed by: belliash GPG Key ID: 4E829243E0CFE6B4
2 changed files with 49 additions and 0 deletions
  1. +41
    -0
      tests/parent_this_statements.aer
  2. +8
    -0
      tests/parent_this_statements.exp

+ 41
- 0
tests/parent_this_statements.aer View File

@ -0,0 +1,41 @@
class Test1 {
protected int $w = 7;
protected static void test1() {
var_dump(++$this->w);
}
}
class Test2 {
private int $x = 4;
protected int $z = 2;
protected void test2() {
var_dump($this->x++);
}
}
class Test3 extends Test2 {
protected int $y = 9;
}
class Test4 extends Test1, Test3 {
public void test4() {
var_dump($this->w);
$this->test1();
$this->test2();
$parent->test2();
var_dump($parent->w);
var_dump($parent->y);
var_dump($parent->z);
var_dump($this->z);
}
}
class Program {
public void main() {
object $test = new Test4();
$test->test4();
}
}

+ 8
- 0
tests/parent_this_statements.exp View File

@ -0,0 +1,8 @@
int(7)
int(8)
int(4)
int(5)
int(8)
int(9)
int(2)
int(2)

Loading…
Cancel
Save