Skip to content

Commit 656ea56

Browse files
committed
More tests
1 parent ff30e59 commit 656ea56

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

test/Exercise/UniteTheTypesTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,18 @@ public function testFailureWhenAdderFunctionHasIncorrectUnion(): void
7373
);
7474
}
7575

76+
public function testFailureWhenAdderFunctionHasCorrectUnionWithExtraTypes(): void
77+
{
78+
$this->runExercise('incorrect-union-extra-type.php');
79+
80+
$this->assertVerifyWasNotSuccessful();
81+
82+
$this->assertResultsHasFailure(
83+
Failure::class,
84+
'Union type is incorrect, it should only accept the required types'
85+
);
86+
}
87+
7688
public function testFailureWhenAdderFunctionParamIsNotVariadic(): void
7789
{
7890
$this->runExercise('union-type-param-not-variadic.php');
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?php
2+
3+
function adder(int|float|string|bool $numbers) {
4+
}

0 commit comments

Comments
 (0)