From 02d088e7d66b924d38b492a1edf9e3852142c691 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 2 Jun 2024 18:05:33 +0100 Subject: [PATCH] #2396 - Add test cases with default param value --- stub/oo/ooparams.zep | 15 +++++++++++++++ tests/Extension/Oo/OoParamsTest.php | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/stub/oo/ooparams.zep b/stub/oo/ooparams.zep index 256f0d32a7..de253ca6ad 100644 --- a/stub/oo/ooparams.zep +++ b/stub/oo/ooparams.zep @@ -126,4 +126,19 @@ class OoParams { return parameter; } + + public function getDefaultParamValue(int i = 0) + { + return i; + } + + public function getDefaultParamValue1(int i = 1) + { + return i; + } + + public function getDefaultParamValueStr(string str = "default") + { + return str; + } } diff --git a/tests/Extension/Oo/OoParamsTest.php b/tests/Extension/Oo/OoParamsTest.php index 34c65a190a..757e3c54bc 100644 --- a/tests/Extension/Oo/OoParamsTest.php +++ b/tests/Extension/Oo/OoParamsTest.php @@ -43,6 +43,10 @@ public function testOoParams(): void $this->assertSame($this->test->setList([1, 2, 3, 4, 5]), [1, 2, 3, 4, 5]); $this->assertSame($this->test->setList([]), []); + + $this->assertSame(0, $this->test->getDefaultParamValue()); + $this->assertSame(1, $this->test->getDefaultParamValue1()); + $this->assertSame('default', $this->test->getDefaultParamValueStr()); } public function setObjectClassCast(): void