From 3689a0239a60d353653af5eb0c3eec25633c4876 Mon Sep 17 00:00:00 2001 From: belliash Date: Fri, 31 May 2019 10:18:17 +0200 Subject: [PATCH] Lets test access to derived attributes. --- tests/parent_this_statements.aer | 41 ++++++++++++++++++++++++++++++++ tests/parent_this_statements.exp | 8 +++++++ 2 files changed, 49 insertions(+) create mode 100644 tests/parent_this_statements.aer create mode 100644 tests/parent_this_statements.exp diff --git a/tests/parent_this_statements.aer b/tests/parent_this_statements.aer new file mode 100644 index 0000000..481ef79 --- /dev/null +++ b/tests/parent_this_statements.aer @@ -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(); + } +} diff --git a/tests/parent_this_statements.exp b/tests/parent_this_statements.exp new file mode 100644 index 0000000..4b973f5 --- /dev/null +++ b/tests/parent_this_statements.exp @@ -0,0 +1,8 @@ +int(7) +int(8) +int(4) +int(5) +int(8) +int(9) +int(2) +int(2)