diff --git a/src/Application/LinkGenerator.php b/src/Application/LinkGenerator.php index eb99a8523..2354b2e1a 100644 --- a/src/Application/LinkGenerator.php +++ b/src/Application/LinkGenerator.php @@ -65,7 +65,7 @@ public function link(string $dest, array $params = []): string throw new UI\InvalidLinkException("Missing parameter \${$rp->getName()} required by $class::{$method->getName()}()"); } } elseif (array_key_exists(0, $params)) { - throw new UI\InvalidLinkException("Unable to pass parameters to action '$presenter:$action', missing corresponding method."); + throw new UI\InvalidLinkException("Unable to pass parameters to action '$presenter:$action', missing corresponding method $class::{$class::formatRenderMethod($action)}()."); } } diff --git a/src/Application/UI/LinkBuilder.php b/src/Application/UI/LinkBuilder.php index 4c66c980f..a1c96cc22 100644 --- a/src/Application/UI/LinkBuilder.php +++ b/src/Application/UI/LinkBuilder.php @@ -164,7 +164,7 @@ public function generateUrl( static::argsToParams($presenterClass, $method->getName(), $args, $path === 'this' ? $this->presenter->getParameters() : [], $missing); } elseif (array_key_exists(0, $args)) { - throw new InvalidLinkException("Unable to pass parameters to action '$presenter:$action', missing corresponding method."); + throw new InvalidLinkException("Unable to pass parameters to action '$presenter:$action', missing corresponding method $presenterClass::{$presenterClass::formatRenderMethod($action)}()."); } // counterpart of StatePersistent diff --git a/tests/Routers/LinkGenerator.phpt b/tests/Routers/LinkGenerator.phpt index 6761e67a9..2b2d6ee83 100644 --- a/tests/Routers/LinkGenerator.phpt +++ b/tests/Routers/LinkGenerator.phpt @@ -77,7 +77,7 @@ namespace { Assert::exception(function () use ($pf) { $generator = new LinkGenerator(new Routers\Route('/', 'Homepage:'), new Http\UrlScript('http://nette.org/en/'), $pf); $generator->link('Homepage:missing', [10]); - }, Nette\Application\UI\InvalidLinkException::class, "Unable to pass parameters to action 'Homepage:missing', missing corresponding method."); + }, Nette\Application\UI\InvalidLinkException::class, "Unable to pass parameters to action 'Homepage:missing', missing corresponding method HomepagePresenter::renderMissing()."); test('', function () { diff --git a/tests/UI/Presenter.link().phpt b/tests/UI/Presenter.link().phpt index 6b98062db..b6b129d28 100644 --- a/tests/UI/Presenter.link().phpt +++ b/tests/UI/Presenter.link().phpt @@ -86,7 +86,7 @@ class TestPresenter extends Application\UI\Presenter Assert::same('/index.php?sort%5By%5D%5Basc%5D=1&action=default&presenter=Test', $this->link('this', ['sort' => ['y' => ['asc' => true]]])); Assert::same(['sort' => ['y' => ['asc' => true]], 'pint' => null, 'parr' => null, 'pbool' => null, 'mycontrol-order' => null, 'mycontrol-round' => null, 'action' => 'default'], $this->getLastCreatedRequest()->getParameters()); - Assert::same("#error: Unable to pass parameters to action 'Test:product', missing corresponding method.", $this->link('product', 1)); + Assert::same("#error: Unable to pass parameters to action 'Test:product', missing corresponding method TestPresenter::renderProduct().", $this->link('product', 1)); Assert::same('/index.php?a=1&action=product&presenter=Test', $this->link('product', ['a' => 1])); Assert::same('#error: Passed more parameters than method TestPresenter::actionParams() expects.', $this->link('params', 1, 2, 3, 4, 5));