From 06a4ab049bc92edceae9085ee21bd1eb3e713ec2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Kucha=C5=99?= <honza.kuchar@grifart.cz> Date: Thu, 27 Apr 2017 08:34:14 +0200 Subject: [PATCH] test fn.assertFunction.wrongNumberOfArguments: added assertion for messages --- ...assertFunction.wrongNumberOfArguments.phpt | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/tests/fn.assertFunction.wrongNumberOfArguments.phpt b/tests/fn.assertFunction.wrongNumberOfArguments.phpt index 198a867..da9e242 100644 --- a/tests/fn.assertFunction.wrongNumberOfArguments.phpt +++ b/tests/fn.assertFunction.wrongNumberOfArguments.phpt @@ -4,15 +4,23 @@ require __DIR__ . '/bootstrap.php'; require __DIR__ . '/testClasses.php'; use function Grifart\AssertFunction\{assertFunction, optional, parameters}; use Tester\Assert; - +$position = 'assert-function-signature/tests/fn.assertFunction.wrongNumberOfArguments.phpt:9'; $f1 = function(T1 $t1, T2 $t2): T3 {return new T3;}; // Wrong number of arguments -Assert::exception(function () use ($f1) { - assertFunction($f1, parameters(T1::class), T3::class); -}, \AssertionError::class); +Assert::exception( + function () use ($f1) { + assertFunction($f1, parameters(T1::class), T3::class); + }, + \AssertionError::class, + "$position Given wrong number of parameters. Expected 1, 2 given." +); -Assert::exception(function () use ($f1) { - assertFunction($f1, parameters(T1::class, T2::class, T1::class), T3::class); -}, \AssertionError::class); +Assert::exception( + function () use ($f1) { + assertFunction($f1, parameters(T1::class, T2::class, T1::class), T3::class); + }, + \AssertionError::class, + "$position Given wrong number of parameters. Expected 3, 2 given." +); -- GitLab