Skip to content
Snippets Groups Projects
Commit 06a4ab04 authored by Jan Kuchař's avatar Jan Kuchař
Browse files

test fn.assertFunction.wrongNumberOfArguments: added assertion for messages

parent 3343ecf9
Branches
Tags
No related merge requests found
...@@ -4,15 +4,23 @@ require __DIR__ . '/bootstrap.php'; ...@@ -4,15 +4,23 @@ require __DIR__ . '/bootstrap.php';
require __DIR__ . '/testClasses.php'; require __DIR__ . '/testClasses.php';
use function Grifart\AssertFunction\{assertFunction, optional, parameters}; use function Grifart\AssertFunction\{assertFunction, optional, parameters};
use Tester\Assert; use Tester\Assert;
$position = 'assert-function-signature/tests/fn.assertFunction.wrongNumberOfArguments.phpt:9';
$f1 = function(T1 $t1, T2 $t2): T3 {return new T3;}; $f1 = function(T1 $t1, T2 $t2): T3 {return new T3;};
// Wrong number of arguments // Wrong number of arguments
Assert::exception(function () use ($f1) { Assert::exception(
assertFunction($f1, parameters(T1::class), T3::class); function () use ($f1) {
}, \AssertionError::class); assertFunction($f1, parameters(T1::class), T3::class);
},
\AssertionError::class,
"$position Given wrong number of parameters. Expected 1, 2 given."
);
Assert::exception(function () use ($f1) { Assert::exception(
assertFunction($f1, parameters(T1::class, T2::class, T1::class), T3::class); function () use ($f1) {
}, \AssertionError::class); assertFunction($f1, parameters(T1::class, T2::class, T1::class), T3::class);
},
\AssertionError::class,
"$position Given wrong number of parameters. Expected 3, 2 given."
);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment