Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

#2396 - Add test cases with default param value #2430

Merged
merged 1 commit into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions stub/oo/ooparams.zep
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
4 changes: 4 additions & 0 deletions tests/Extension/Oo/OoParamsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading