From 486ec417e359cb1536840edc71263bfe106ef6ff Mon Sep 17 00:00:00 2001 From: David Grudl Date: Sun, 2 Feb 2025 02:24:33 +0100 Subject: [PATCH] tests: improved descriptions --- tests/Application/Application.run.phpt | 17 +++++++---------- tests/Application/MicroPresenter.invoke.phpt | 4 ++-- tests/Application/MicroPresenter.response.phpt | 14 +++++++------- .../PresenterFactory.formatPresenterClass.phpt | 15 ++++++++------- tests/Application/Request.phpt | 4 ++-- .../ApplicationExtension.invalidLink.phpt | 8 ++++---- .../Bridges.DI/ApplicationExtension.scan.phpt | 8 ++++---- tests/Bridges.DI/RoutingExtension.cache.phpt | 6 +++--- .../TemplateFactory.customTemplate.phpt | 7 ++++--- tests/Responses/CallbackResponse.phpt | 2 +- .../FileResponse.contentDisposition.phpt | 6 +++--- tests/Responses/FileResponse.full.phpt | 4 ++-- tests/Responses/FileResponse.range.phpt | 16 ++++++++-------- tests/Responses/JsonResponse.contentType.phpt | 4 ++-- tests/Routers/LinkGenerator.phpt | 12 ++++++------ tests/Routers/Route.scalarParams.phpt | 12 ++++++------ tests/Routers/SimpleRouter.invalid.phpt | 4 ++-- tests/UI/Component.redirect().phpt | 10 +++++----- tests/UI/Control.formatTemplateClass.phpt | 6 +++--- tests/UI/Control.isControlInvalid.phpt | 4 ++-- tests/UI/Form.phpt | 4 ++-- tests/UI/ParameterConverter.toArguments.phpt | 16 ++++++++-------- .../Presenter.formatLayoutTemplateFiles.phpt | 14 +++++++------- tests/UI/Presenter.formatTemplateClass.phpt | 8 ++++---- tests/UI/Presenter.formatTemplateFiles.phpt | 12 ++++++------ tests/UI/Presenter.initGlobalParameters().phpt | 18 +++++++++--------- tests/UI/Presenter.isModuleCurrent().phpt | 4 ++-- tests/UI/Presenter.storeRequest().phpt | 4 ++-- 28 files changed, 121 insertions(+), 122 deletions(-) diff --git a/tests/Application/Application.run.phpt b/tests/Application/Application.run.phpt index fb598e964..48d2ce82c 100644 --- a/tests/Application/Application.run.phpt +++ b/tests/Application/Application.run.phpt @@ -96,8 +96,7 @@ $httpResponse = Mockery::mock(Nette\Http\IResponse::class); $httpResponse->shouldIgnoreMissing(); -// no route without error presenter -Assert::exception(function () use ($httpRequest, $httpResponse) { +testException('No route handling without error presenter', function () use ($httpRequest, $httpResponse) { $presenterFactory = Mockery::mock(IPresenterFactory::class); $router = Mockery::mock(Router::class); $router->shouldReceive('match')->andReturn(null); @@ -107,7 +106,7 @@ Assert::exception(function () use ($httpRequest, $httpResponse) { }, BadRequestException::class, 'No route for HTTP request.'); -test('no route with error presenter', function () use ($httpRequest, $httpResponse) { +test('Error presenter handling for route mismatch', function () use ($httpRequest, $httpResponse) { $errorPresenter = new ErrorPresenter; $presenterFactory = Mockery::mock(IPresenterFactory::class); @@ -133,7 +132,7 @@ test('no route with error presenter', function () use ($httpRequest, $httpRespon }); -test('route to error presenter', function () use ($httpRequest, $httpResponse) { +test('Error presenter invoked directly via router', function () use ($httpRequest, $httpResponse) { $errorPresenter = new ErrorPresenter; $presenterFactory = Mockery::mock(IPresenterFactory::class); @@ -161,8 +160,7 @@ test('route to error presenter', function () use ($httpRequest, $httpResponse) { }); -// missing presenter without error presenter -Assert::exception(function () use ($httpRequest, $httpResponse) { +testException('Missing presenter exception without error presenter', function () use ($httpRequest, $httpResponse) { $presenterFactory = Mockery::mock(IPresenterFactory::class); $presenterFactory->shouldReceive('createPresenter')->with('Missing')->andThrow(Nette\Application\InvalidPresenterException::class); @@ -174,7 +172,7 @@ Assert::exception(function () use ($httpRequest, $httpResponse) { }, BadRequestException::class); -test('missing presenter with error presenter', function () use ($httpRequest, $httpResponse) { +test('Missing presenter fallback to error presenter', function () use ($httpRequest, $httpResponse) { $errorPresenter = new ErrorPresenter; $presenterFactory = Mockery::mock(IPresenterFactory::class); @@ -203,8 +201,7 @@ test('missing presenter with error presenter', function () use ($httpRequest, $h }); -// presenter error without error presenter -Assert::exception(function () use ($httpRequest, $httpResponse) { +testException('Presenter exception propagation without error handling', function () use ($httpRequest, $httpResponse) { $presenterFactory = Mockery::mock(IPresenterFactory::class); $presenterFactory->shouldReceive('createPresenter')->with('Bad')->andReturn(new BadPresenter); @@ -216,7 +213,7 @@ Assert::exception(function () use ($httpRequest, $httpResponse) { }, BadException::class); -test('presenter error with error presenter', function () use ($httpRequest, $httpResponse) { +test('Presenter exception propagation to error presenter', function () use ($httpRequest, $httpResponse) { $badPresenter = new BadPresenter; $errorPresenter = new ErrorPresenter; diff --git a/tests/Application/MicroPresenter.invoke.phpt b/tests/Application/MicroPresenter.invoke.phpt index 2376d885e..9ed6d76fa 100644 --- a/tests/Application/MicroPresenter.invoke.phpt +++ b/tests/Application/MicroPresenter.invoke.phpt @@ -13,7 +13,7 @@ use Tester\Assert; require __DIR__ . '/../bootstrap.php'; -test('', function () { +test('Callback invocation with parameters', function () { $presenter = $p = new NetteModule\MicroPresenter; $presenter->run(new Request('Nette:Micro', 'GET', [ @@ -30,7 +30,7 @@ test('', function () { }); -test('', function () { +test('Dependency injection in callback', function () { $container = Mockery::mock(Nette\DI\Container::class) ->shouldReceive('getByType')->with('stdClass', false)->once()->andReturn(new stdClass) ->mock(); diff --git a/tests/Application/MicroPresenter.response.phpt b/tests/Application/MicroPresenter.response.phpt index ae5d7db32..4245ecfde 100644 --- a/tests/Application/MicroPresenter.response.phpt +++ b/tests/Application/MicroPresenter.response.phpt @@ -37,7 +37,7 @@ function createContainer() } -test('', function () { +test('TextResponse with direct output', function () { $presenter = new NetteModule\MicroPresenter(createContainer()); $response = $presenter->run(new Request('Nette:Micro', 'GET', [ 'callback' => fn() => 'test', @@ -48,7 +48,7 @@ test('', function () { }); -test('', function () { +test('Parameter passing to callback', function () { $presenter = new NetteModule\MicroPresenter(createContainer()); $response = $presenter->run(new Request('Nette:Micro', 'GET', [ 'callback' => fn($param) => $param, @@ -60,7 +60,7 @@ test('', function () { }); -test('', function () { +test('Latte template evaluation', function () { $presenter = new NetteModule\MicroPresenter(createContainer()); $response = $presenter->run(new Request('Nette:Micro', 'GET', [ 'callback' => fn() => '{=date(Y)}', @@ -71,7 +71,7 @@ test('', function () { }); -test('', function () { +test('Template file with parameters', function () { $presenter = new NetteModule\MicroPresenter(createContainer()); $response = $presenter->run(new Request('Nette:Micro', 'GET', [ 'callback' => fn() => [new SplFileInfo(Tester\FileMock::create('{$param}')), []], @@ -83,7 +83,7 @@ test('', function () { }); -test('', function () { +test('Manual template creation', function () { $presenter = new NetteModule\MicroPresenter; $response = $presenter->run(new Request('Nette:Micro', 'GET', [ @@ -101,7 +101,7 @@ test('', function () { }); -test('', function () { +test('Template file loader with parameters', function () { $presenter = new NetteModule\MicroPresenter; $response = $presenter->run(new Request('Nette:Micro', 'GET', [ @@ -120,7 +120,7 @@ test('', function () { }); -test('', function () { +test('Missing template file handling', function () { $filename = 'notfound.latte'; Assert::exception(function () use ($filename) { $presenter = new NetteModule\MicroPresenter; diff --git a/tests/Application/PresenterFactory.formatPresenterClass.phpt b/tests/Application/PresenterFactory.formatPresenterClass.phpt index 3ef876bb9..5237848ab 100644 --- a/tests/Application/PresenterFactory.formatPresenterClass.phpt +++ b/tests/Application/PresenterFactory.formatPresenterClass.phpt @@ -13,7 +13,7 @@ use Tester\Assert; require __DIR__ . '/../bootstrap.php'; -test('defined module', function () { +test('Complex mapping with multiple wildcards', function () { $factory = new PresenterFactory; $factory->setMapping([ @@ -36,7 +36,7 @@ test('defined module', function () { }); -test('auto module', function () { +test('Simple wildcard mapping', function () { $factory = new PresenterFactory; $factory->setMapping([ @@ -53,7 +53,7 @@ test('auto module', function () { }); -test('location ** & defined module', function () { +test('Multi-segment wildcard expansion', function () { $factory = new PresenterFactory; $factory->setMapping([ @@ -76,7 +76,7 @@ test('location ** & defined module', function () { }); -test('location ** & auto module', function () { +test('Global wildcard mapping strategy', function () { $factory = new PresenterFactory; $factory->setMapping([ @@ -94,7 +94,7 @@ test('location ** & auto module', function () { }); -test('', function () { +test('Array-based hierarchical mapping', function () { $factory = new PresenterFactory; $factory->setMapping([ '*' => ['App', 'Module\*', 'Presenter\*'], @@ -104,7 +104,7 @@ test('', function () { }); -test('', function () { +test('Empty namespace mapping structure', function () { $factory = new PresenterFactory; $factory->setMapping([ '*' => ['', '*', '*'], @@ -113,7 +113,8 @@ test('', function () { }); -Assert::exception( +testException( + 'Invalid mapping mask validation', function () { $factory = new PresenterFactory; $factory->setMapping([ diff --git a/tests/Application/Request.phpt b/tests/Application/Request.phpt index 7ae61fed5..a6dd4a1c0 100644 --- a/tests/Application/Request.phpt +++ b/tests/Application/Request.phpt @@ -13,7 +13,7 @@ use Tester\Assert; require __DIR__ . '/../bootstrap.php'; -test('', function () { +test('Request parameters with null values', function () { $request = new Request('Homepage', 'GET', ['a' => 1, 'b' => null]); Assert::same(1, $request->getParameter('a')); @@ -21,7 +21,7 @@ test('', function () { }); -test('', function () { +test('POST parameters retrieval', function () { $request = new Request('Homepage', 'GET', [], ['a' => 1, 'b' => null]); Assert::same(['a' => 1, 'b' => null], $request->getPost()); diff --git a/tests/Bridges.DI/ApplicationExtension.invalidLink.phpt b/tests/Bridges.DI/ApplicationExtension.invalidLink.phpt index 7f02c95b9..dd70c50c3 100644 --- a/tests/Bridges.DI/ApplicationExtension.invalidLink.phpt +++ b/tests/Bridges.DI/ApplicationExtension.invalidLink.phpt @@ -24,7 +24,7 @@ function createCompiler(string $config): DI\Compiler } -test('', function () { +test('silentLinks enabled with debugger', function () { $compiler = createCompiler(' application: silentLinks: yes @@ -44,7 +44,7 @@ test('', function () { }); -test('', function () { +test('silentLinks disabled with debugger', function () { $compiler = createCompiler(' application: silentLinks: no @@ -64,7 +64,7 @@ test('', function () { }); -test('', function () { +test('silentLinks enabled without debugger', function () { $compiler = createCompiler(' application: silentLinks: yes @@ -84,7 +84,7 @@ test('', function () { }); -test('', function () { +test('silentLinks disabled without debugger', function () { $compiler = createCompiler(' application: silentLinks: no diff --git a/tests/Bridges.DI/ApplicationExtension.scan.phpt b/tests/Bridges.DI/ApplicationExtension.scan.phpt index 761880f43..f6a8f56de 100644 --- a/tests/Bridges.DI/ApplicationExtension.scan.phpt +++ b/tests/Bridges.DI/ApplicationExtension.scan.phpt @@ -12,7 +12,7 @@ require __DIR__ . '/../bootstrap.php'; require __DIR__ . '/files/MyPresenter.php'; -test('', function () { +test('default presenter registration', function () { $compiler = new DI\Compiler; $compiler->addExtension('application', new ApplicationExtension); @@ -30,7 +30,7 @@ test('', function () { }); -test('', function () { +test('scanDirs with filter', function () { $compiler = new DI\Compiler; $compiler->addExtension('application', new ApplicationExtension); @@ -53,7 +53,7 @@ test('', function () { }); -test('', function () { +test('combined scanDirs and config setup', function () { $compiler = new DI\Compiler; $compiler->addExtension('application', new ApplicationExtension(false, [__DIR__ . '/files'])); @@ -85,7 +85,7 @@ test('', function () { }); -test('', function () { +test('RobotLoader discovery', function () { $robot = new Nette\Loaders\RobotLoader; $robot->addDirectory(__DIR__ . '/files'); $robot->setTempDirectory(getTempDir()); diff --git a/tests/Bridges.DI/RoutingExtension.cache.phpt b/tests/Bridges.DI/RoutingExtension.cache.phpt index bd7423446..322557fea 100644 --- a/tests/Bridges.DI/RoutingExtension.cache.phpt +++ b/tests/Bridges.DI/RoutingExtension.cache.phpt @@ -37,7 +37,7 @@ class MyRouter implements Nette\Routing\Router } -test('', function () { +test('router without cache', function () { $loader = new DI\Config\Loader; $config = $loader->load(Tester\FileMock::create(' services: @@ -55,7 +55,7 @@ test('', function () { }); -test('', function () { +test('router with cache', function () { $loader = new DI\Config\Loader; $config = $loader->load(Tester\FileMock::create(' routing: @@ -82,7 +82,7 @@ function myRouterFactory(): Nette\Routing\Router } -Assert::exception(function () { +testException('non-cacheable router factory', function () { $loader = new DI\Config\Loader; $config = $loader->load(Tester\FileMock::create(' routing: diff --git a/tests/Bridges.Latte3/TemplateFactory.customTemplate.phpt b/tests/Bridges.Latte3/TemplateFactory.customTemplate.phpt index 976f99b78..e231cdb34 100644 --- a/tests/Bridges.Latte3/TemplateFactory.customTemplate.phpt +++ b/tests/Bridges.Latte3/TemplateFactory.customTemplate.phpt @@ -46,21 +46,22 @@ class TemplateMock extends Template } -test('', function () { +test('default template creation', function () { $latteFactory = Mockery::mock(LatteFactory::class); $latteFactory->shouldReceive('create')->andReturn(new Latte\Engine); $factory = new TemplateFactory($latteFactory); Assert::type(Template::class, $factory->createTemplate()); }); -Assert::exception( +testException( + '13456', fn() => new TemplateFactory(Mockery::mock(LatteFactory::class), templateClass: stdClass::class), Nette\InvalidArgumentException::class, 'Class stdClass does not implement Nette\Bridges\ApplicationLatte\Template or it does not exist.', ); -test('', function () { +test('custom template behavior', function () { $latteFactory = Mockery::mock(LatteFactory::class); $latteFactory->shouldReceive('create')->andReturn(new Latte\Engine); $factory = new TemplateFactory($latteFactory, templateClass: TemplateMock::class); diff --git a/tests/Responses/CallbackResponse.phpt b/tests/Responses/CallbackResponse.phpt index 8579c95e8..597023230 100644 --- a/tests/Responses/CallbackResponse.phpt +++ b/tests/Responses/CallbackResponse.phpt @@ -14,7 +14,7 @@ use Tester\Assert; require __DIR__ . '/../bootstrap.php'; -test('', function () { +test('Callback execution on send', function () { $response = new CallbackResponse(function (Http\IRequest $request, Http\IResponse $response) use (&$ok) { $ok = true; }); diff --git a/tests/Responses/FileResponse.contentDisposition.phpt b/tests/Responses/FileResponse.contentDisposition.phpt index 173b8680d..90cff5b2f 100644 --- a/tests/Responses/FileResponse.contentDisposition.phpt +++ b/tests/Responses/FileResponse.contentDisposition.phpt @@ -18,7 +18,7 @@ if (PHP_SAPI === 'cli') { } -test('', function () { +test('Default attachment content disposition', function () { $file = __FILE__; $fileResponse = new FileResponse($file); $origData = file_get_contents($file); @@ -34,7 +34,7 @@ test('', function () { }); -test('', function () { +test('Inline content disposition', function () { $file = __FILE__; $fileResponse = new FileResponse($file, forceDownload: false); $origData = file_get_contents($file); @@ -50,7 +50,7 @@ test('', function () { }); -test('', function () { +test('Filename with special characters', function () { $file = __FILE__; $fileName = 'žluťoučký kůň.txt'; $fileResponse = new FileResponse($file, $fileName); diff --git a/tests/Responses/FileResponse.full.phpt b/tests/Responses/FileResponse.full.phpt index dc5528913..1037aa620 100644 --- a/tests/Responses/FileResponse.full.phpt +++ b/tests/Responses/FileResponse.full.phpt @@ -15,7 +15,7 @@ require __DIR__ . '/../bootstrap.php'; /* A small file */ -test('', function () { +test('Small file content delivery', function () { $file = __FILE__; $fileResponse = new FileResponse($file); $origData = file_get_contents($file); @@ -26,7 +26,7 @@ test('', function () { }); /* A big file */ -test('', function () { +test('Large file content delivery', function () { $file = Tester\FileMock::create(); $data = ''; diff --git a/tests/Responses/FileResponse.range.phpt b/tests/Responses/FileResponse.range.phpt index 99c380854..ae22ac4d9 100644 --- a/tests/Responses/FileResponse.range.phpt +++ b/tests/Responses/FileResponse.range.phpt @@ -19,7 +19,7 @@ $file = __FILE__; $fileResponse = new FileResponse($file); $origData = file_get_contents($file); -test('', function () use ($fileResponse, $origData) { +test('Partial content with byte range', function () use ($fileResponse, $origData) { ob_start(); $fileResponse->send( new Http\Request(new Http\UrlScript, headers: ['range' => 'bytes=10-20']), @@ -30,7 +30,7 @@ test('', function () use ($fileResponse, $origData) { }); -test('', function () use ($fileResponse, $origData) { +test('Single byte range request', function () use ($fileResponse, $origData) { ob_start(); $fileResponse->send( new Http\Request(new Http\UrlScript, headers: ['range' => 'bytes=10-10']), @@ -40,7 +40,7 @@ test('', function () use ($fileResponse, $origData) { }); -test('', function () use ($fileResponse, $origData, $file) { +test('Range from offset to end', function () use ($fileResponse, $origData, $file) { ob_start(); $fileResponse->send( new Http\Request(new Http\UrlScript, headers: ['range' => 'bytes=10-' . filesize($file)]), @@ -50,7 +50,7 @@ test('', function () use ($fileResponse, $origData, $file) { }); -test('prefix', function () use ($fileResponse, $origData) { +test('Range starting at offset', function () use ($fileResponse, $origData) { ob_start(); $fileResponse->send( new Http\Request(new Http\UrlScript, headers: ['range' => 'bytes=20-']), @@ -60,7 +60,7 @@ test('prefix', function () use ($fileResponse, $origData) { }); -test('prefix', function () use ($fileResponse, $origData, $file) { +test('Last byte range request', function () use ($fileResponse, $origData, $file) { ob_start(); $fileResponse->send( new Http\Request(new Http\UrlScript, headers: ['range' => 'bytes=' . (filesize($file) - 1) . '-']), @@ -70,7 +70,7 @@ test('prefix', function () use ($fileResponse, $origData, $file) { }); -test('prefix', function () use ($fileResponse, $file) { +test('Invalid byte range handling', function () use ($fileResponse, $file) { ob_start(); $fileResponse->send( new Http\Request(new Http\UrlScript, headers: ['range' => 'bytes=' . filesize($file) . '-']), @@ -81,7 +81,7 @@ test('prefix', function () use ($fileResponse, $file) { }); -test('suffix', function () use ($fileResponse, $origData) { +test('Negative offset range (last bytes)', function () use ($fileResponse, $origData) { ob_start(); $fileResponse->send( new Http\Request(new Http\UrlScript, headers: ['range' => 'bytes=-20']), @@ -91,7 +91,7 @@ test('suffix', function () use ($fileResponse, $origData) { }); -test('suffix', function () use ($fileResponse, $origData, $file) { +test('Full content via negative range', function () use ($fileResponse, $origData, $file) { ob_start(); $fileResponse->send( new Http\Request(new Http\UrlScript, headers: ['range' => 'bytes=-' . filesize($file)]), diff --git a/tests/Responses/JsonResponse.contentType.phpt b/tests/Responses/JsonResponse.contentType.phpt index 0cbe48d12..5d6e947cf 100644 --- a/tests/Responses/JsonResponse.contentType.phpt +++ b/tests/Responses/JsonResponse.contentType.phpt @@ -17,7 +17,7 @@ if (PHP_SAPI === 'cli') { Tester\Environment::skip('Requires CGI SAPI to work with HTTP headers.'); } -test('', function () { +test('JSON content type with UTF-8 charset', function () { $data = ['text' => 'žluťoučký kůň']; $encoded = json_encode($data, JSON_UNESCAPED_UNICODE); $jsonResponse = new JsonResponse($data, 'application/json'); @@ -29,7 +29,7 @@ test('', function () { Assert::same('application/json; charset=utf-8', $response->getHeader('Content-Type')); }); -test('', function () { +test('Boolean data JSON encoding', function () { $data = true; $encoded = json_encode($data, JSON_UNESCAPED_UNICODE); $jsonResponse = new JsonResponse($data, 'application/json'); diff --git a/tests/Routers/LinkGenerator.phpt b/tests/Routers/LinkGenerator.phpt index 3acc40491..ca918882c 100644 --- a/tests/Routers/LinkGenerator.phpt +++ b/tests/Routers/LinkGenerator.phpt @@ -49,7 +49,7 @@ namespace { $pf = new PresenterFactory; - test('', function () use ($pf) { + test('Basic link generation with various parameters', function () use ($pf) { $generator = new LinkGenerator(new Routers\SimpleRouter, new Http\UrlScript('http://nette.org/en/'), $pf); Assert::same('http://nette.org/en/?action=default&presenter=Homepage', $generator->link('Homepage:default')); Assert::same('http://nette.org/en/?action=default&presenter=Module%3AMy', $generator->link('Module:My:default')); @@ -62,25 +62,25 @@ namespace { }); - Assert::exception(function () use ($pf) { + testException('Missing presenter specification error', function () use ($pf) { $generator = new LinkGenerator(new Routers\SimpleRouter, new Http\UrlScript('http://nette.org/en/'), $pf); $generator->link('default'); }, LogicException::class, "Presenter must be specified in 'default'."); - Assert::exception(function () use ($pf) { + testException('Route mismatch exception handling', function () use ($pf) { $generator = new LinkGenerator(new Routers\Route('/', 'Product:'), new Http\UrlScript('http://nette.org/en/'), $pf); $generator->link('Homepage:default', ['id' => 10]); }, Nette\Application\UI\InvalidLinkException::class, 'No route for Homepage:default(id=10)'); - Assert::exception(function () use ($pf) { + testException('Invalid action parameter propagation', 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 HomepagePresenter::renderMissing()."); - test('', function () { + test('URL generation without PresenterFactory', function () { $generator = new LinkGenerator(new Routers\SimpleRouter, new Http\UrlScript('http://nette.org/en/')); Assert::same('http://nette.org/en/?action=default&presenter=Homepage', $generator->link('Homepage:default')); Assert::same('http://nette.org/en/?action=default&presenter=Module%3AMy', $generator->link('Module:My:default')); @@ -93,7 +93,7 @@ namespace { }); - test('', function () { + test('Reference URL context switching', function () { $generator = new LinkGenerator(new Routers\SimpleRouter, new Http\UrlScript('http://nette.org/en/')); $generator2 = $generator->withReferenceUrl('http://nette.org/cs/'); Assert::same('http://nette.org/en/?action=default&presenter=Homepage', $generator->link('Homepage:default')); diff --git a/tests/Routers/Route.scalarParams.phpt b/tests/Routers/Route.scalarParams.phpt index 4f475fea3..176224fd8 100644 --- a/tests/Routers/Route.scalarParams.phpt +++ b/tests/Routers/Route.scalarParams.phpt @@ -15,7 +15,7 @@ require __DIR__ . '/../bootstrap.php'; require __DIR__ . '/Route.php'; -test('', function () { +test('Numeric and boolean parameter serialization', function () { $route = new Route('/', [ ]); @@ -44,7 +44,7 @@ test('', function () { }); -test('', function () { +test('Default integer parameter handling', function () { $route = new Route('/', [ 'param' => 12, ]); @@ -78,7 +78,7 @@ test('', function () { }); -test('', function () { +test('Default float parameter handling', function () { $route = new Route('/', [ 'param' => 12.1, ]); @@ -112,7 +112,7 @@ test('', function () { }); -test('', function () { +test('Boolean default parameter optimization', function () { $route = new Route('/', [ 'param' => true, ]); @@ -146,7 +146,7 @@ test('', function () { }); -test('', function () { +test('False default parameter optimization', function () { $route = new Route('/', [ 'param' => false, ]); @@ -180,7 +180,7 @@ test('', function () { }); -test('', function () { +test('Null default parameter handling', function () { $route = new Route('/', [ 'param' => null, ]); diff --git a/tests/Routers/SimpleRouter.invalid.phpt b/tests/Routers/SimpleRouter.invalid.phpt index ab34229e0..a364a2d0e 100644 --- a/tests/Routers/SimpleRouter.invalid.phpt +++ b/tests/Routers/SimpleRouter.invalid.phpt @@ -16,7 +16,7 @@ require __DIR__ . '/../bootstrap.php'; -test('', function () { +test('Array parameter in presenter name', function () { $router = new SimpleRouter; $url = new Http\UrlScript('http://nette.org?presenter[]=foo'); $httpRequest = new Http\Request($url); @@ -25,7 +25,7 @@ test('', function () { Assert::same(['presenter' => ['foo']], $req); }); -test('', function () { +test('Empty request parameter handling', function () { $router = new SimpleRouter; $url = new Http\UrlScript('http://nette.org'); $httpRequest = new Http\Request($url); diff --git a/tests/UI/Component.redirect().phpt b/tests/UI/Component.redirect().phpt index 60f3972f5..93442b85a 100644 --- a/tests/UI/Component.redirect().phpt +++ b/tests/UI/Component.redirect().phpt @@ -41,7 +41,7 @@ $presenter->injectPrimary( ); -test('', function () use ($presenter) { +test('Basic redirect response generation', function () use ($presenter) { try { $presenter->redirect('foo'); } catch (Throwable) { @@ -52,7 +52,7 @@ test('', function () use ($presenter) { }); -test('', function () use ($presenter) { +test('Redirect with named parameters', function () use ($presenter) { try { $presenter->redirect('foo', ['arg' => 1]); } catch (Throwable) { @@ -63,7 +63,7 @@ test('', function () use ($presenter) { }); -test('', function () use ($presenter) { +test('Positional parameter in redirect', function () use ($presenter) { try { $presenter->redirect('foo', 2); } catch (Throwable) { @@ -74,7 +74,7 @@ test('', function () use ($presenter) { }); -test('', function () use ($presenter) { +test('Permanent redirect with parameter', function () use ($presenter) { try { $presenter->redirectPermanent('foo', 2); } catch (Throwable) { @@ -85,7 +85,7 @@ test('', function () use ($presenter) { }); -test('', function () use ($presenter) { +test('Permanent redirect with named parameters', function () use ($presenter) { try { $presenter->redirectPermanent('foo', ['arg' => 1]); } catch (Throwable) { diff --git a/tests/UI/Control.formatTemplateClass.phpt b/tests/UI/Control.formatTemplateClass.phpt index 4d66a4a49..4109cfdb3 100644 --- a/tests/UI/Control.formatTemplateClass.phpt +++ b/tests/UI/Control.formatTemplateClass.phpt @@ -46,13 +46,13 @@ class CTemplate implements Nette\Application\UI\Template } -test('without template', function () { +test('No associated template class', function () { $control = new AControl; Assert::null($control->formatTemplateClass()); }); -test('with class', function () { +test('Template class missing interface implementation', function () { Assert::error(function () { $control = new BControl; Assert::null($control->formatTemplateClass()); @@ -60,7 +60,7 @@ test('with class', function () { }); -test('with template', function () { +test('Valid template class implementation', function () { $control = new CControl; Assert::same(CTemplate::class, $control->formatTemplateClass()); }); diff --git a/tests/UI/Control.isControlInvalid.phpt b/tests/UI/Control.isControlInvalid.phpt index 0021c9b9e..0dffb5bed 100644 --- a/tests/UI/Control.isControlInvalid.phpt +++ b/tests/UI/Control.isControlInvalid.phpt @@ -18,7 +18,7 @@ class TestControl extends UI\Control } -test('', function () { +test('Direct child component invalidation', function () { $control = new TestControl; $child = new TestControl; $control->addComponent($child, 'foo'); @@ -29,7 +29,7 @@ test('', function () { }); -test('', function () { +test('Nested component invalidation propagation', function () { $control = new TestControl; $child = new Nette\ComponentModel\Container; $grandChild = new TestControl; diff --git a/tests/UI/Form.phpt b/tests/UI/Form.phpt index 66c8ef39b..74e645d8f 100644 --- a/tests/UI/Form.phpt +++ b/tests/UI/Form.phpt @@ -18,14 +18,14 @@ class TestPresenter extends UI\Presenter } -test('', function () { +test('Form method setup validation', function () { $presenter = new TestPresenter; $form = new UI\Form($presenter, 'name'); $form->setMethod($form::Get); // must not throw exception }); -test('compatibility with 2.0', function () { +test('Form action assignment check', function () { $presenter = new TestPresenter; $form = new UI\Form; $form->setAction('action'); diff --git a/tests/UI/ParameterConverter.toArguments.phpt b/tests/UI/ParameterConverter.toArguments.phpt index 688a2086c..6cdc93592 100644 --- a/tests/UI/ParameterConverter.toArguments.phpt +++ b/tests/UI/ParameterConverter.toArguments.phpt @@ -65,7 +65,7 @@ class MyPresenter } -test('', function () { +test('Untyped parameter handling', function () { $method = new ReflectionMethod('MyPresenter', 'params'); Assert::same([null, null, null, null], ParameterConverter::toArguments($method, [])); @@ -91,7 +91,7 @@ test('', function () { }); -test('', function () { +test('Type-hinted parameter validation', function () { $method = new ReflectionMethod('MyPresenter', 'hints'); Assert::same( @@ -144,7 +144,7 @@ test('', function () { }); -test('', function () { +test('Nullable type-hinted parameters with defaults', function () { $method = new ReflectionMethod('MyPresenter', 'hintsNulls'); Assert::same([null, null, null, null, null], ParameterConverter::toArguments($method, [])); @@ -193,7 +193,7 @@ test('', function () { }); -test('', function () { +test('Nullable parameter type conversion', function () { $method = new ReflectionMethod('MyPresenter', 'hintsNullable'); Assert::same([null, null, null, null, null], ParameterConverter::toArguments($method, [])); @@ -242,7 +242,7 @@ test('', function () { }); -test('', function () { +test('Default values with type hints', function () { $method = new ReflectionMethod('MyPresenter', 'hintsDefaults'); Assert::same([0, false, '', [], []], ParameterConverter::toArguments($method, [])); @@ -291,7 +291,7 @@ test('', function () { }); -test('', function () { +test('Untyped parameters with defaults', function () { $method = new ReflectionMethod('MyPresenter', 'defaults'); Assert::same([0, false, '', []], ParameterConverter::toArguments($method, [])); @@ -340,7 +340,7 @@ test('', function () { }); -test('', function () { +test('Object type parameter validation', function () { $method = new ReflectionMethod('MyPresenter', 'objects'); Assert::equal( @@ -374,7 +374,7 @@ test('', function () { }); -test('', function () { +test('Union type parameter handling', function () { $method = new ReflectionMethod('MyPresenter', 'hintsUnion'); Assert::same([1, 'abc'], ParameterConverter::toArguments($method, ['intArray' => '1', 'strArray' => 'abc'])); diff --git a/tests/UI/Presenter.formatLayoutTemplateFiles.phpt b/tests/UI/Presenter.formatLayoutTemplateFiles.phpt index 9794a50f6..ef8e6be39 100644 --- a/tests/UI/Presenter.formatLayoutTemplateFiles.phpt +++ b/tests/UI/Presenter.formatLayoutTemplateFiles.phpt @@ -15,7 +15,7 @@ require __DIR__ . '/one/sub/BPresenter.php'; require __DIR__ . '/two/CPresenter.php'; -test('with subdir templates', function () { +test('Layout template paths for root presenter', function () { $presenter = new APresenter; $presenter->setParent(null, 'One'); $presenter->setLayout('my'); @@ -28,7 +28,7 @@ test('with subdir templates', function () { }); -test('with parent-dir templates', function () { +test('Submodule presenter layout resolution', function () { $presenter = new BPresenter; $presenter->setParent(null, 'One'); $presenter->setLayout('my'); @@ -41,7 +41,7 @@ test('with parent-dir templates', function () { }); -test('without subdir templates', function () { +test('Default layout template hierarchy', function () { $presenter = new CPresenter; $presenter->setParent(null, 'Two'); @@ -52,7 +52,7 @@ test('without subdir templates', function () { }); -test('with module & subdir templates', function () { +test('Multi-module layout template paths', function () { $presenter = new APresenter; $presenter->setParent(null, 'Module:SubModule:One'); @@ -66,7 +66,7 @@ test('with module & subdir templates', function () { }); -test('with module & parent-dir templates', function () { +test('Nested module template inheritance', function () { $presenter = new BPresenter; $presenter->setParent(null, 'Module:SubModule:One'); @@ -80,7 +80,7 @@ test('with module & parent-dir templates', function () { }); -test('with module & without subdir templates', function () { +test('Deep module structure layout resolution', function () { $presenter = new CPresenter; $presenter->setParent(null, 'Module:SubModule:Two'); @@ -93,7 +93,7 @@ test('with module & without subdir templates', function () { }); -test('direct file', function () { +test('Explicit layout file assignment', function () { $presenter = new BPresenter; $presenter->setLayout(__DIR__ . '/file.latte'); diff --git a/tests/UI/Presenter.formatTemplateClass.phpt b/tests/UI/Presenter.formatTemplateClass.phpt index b9ed33bb7..e905313a3 100644 --- a/tests/UI/Presenter.formatTemplateClass.phpt +++ b/tests/UI/Presenter.formatTemplateClass.phpt @@ -49,13 +49,13 @@ class CBarTemplate extends CTemplate { } -test('without template', function () { +test('Without template', function () { $presenter = new APresenter; Assert::null($presenter->formatTemplateClass()); }); -test('with class', function () { +test('Template class missing interface implementation', function () { Assert::error(function () { $presenter = new BPresenter; Assert::null($presenter->formatTemplateClass()); @@ -63,13 +63,13 @@ test('with class', function () { }); -test('with template', function () { +test('Valid template class resolution', function () { $presenter = new CPresenter; Assert::same(CTemplate::class, $presenter->formatTemplateClass()); }); -test('with action template', function () { +test('Action-specific template class selection', function () { $presenter = new CPresenter; $presenter->changeAction('foo'); Assert::same(CTemplate::class, $presenter->formatTemplateClass()); diff --git a/tests/UI/Presenter.formatTemplateFiles.phpt b/tests/UI/Presenter.formatTemplateFiles.phpt index 2b253fbe4..b432102d0 100644 --- a/tests/UI/Presenter.formatTemplateFiles.phpt +++ b/tests/UI/Presenter.formatTemplateFiles.phpt @@ -15,7 +15,7 @@ require __DIR__ . '/one/sub/BPresenter.php'; require __DIR__ . '/two/CPresenter.php'; -test('with subdir templates', function () { +test('Template file paths for root presenter', function () { $presenter = new APresenter; $presenter->setParent(null, 'One'); $presenter->setView('view'); @@ -27,7 +27,7 @@ test('with subdir templates', function () { }); -test('with parent-dir templates', function () { +test('Submodule presenter template resolution', function () { $presenter = new BPresenter; $presenter->setParent(null, 'One'); $presenter->setView('view'); @@ -39,7 +39,7 @@ test('with parent-dir templates', function () { }); -test('without subdir templates', function () { +test('Flat module structure template lookup', function () { $presenter = new CPresenter; $presenter->setParent(null, 'Two'); $presenter->setView('view'); @@ -50,7 +50,7 @@ test('without subdir templates', function () { }); -test('with module & subdir templates', function () { +test('Module-prefixed presenter template paths', function () { $presenter = new APresenter; $presenter->setParent(null, 'Module:One'); $presenter->setView('view'); @@ -62,7 +62,7 @@ test('with module & subdir templates', function () { }); -test('with module & parent-dir templates', function () { +test('Nested module template inheritance', function () { $presenter = new BPresenter; $presenter->setParent(null, 'Module:One'); $presenter->setView('view'); @@ -74,7 +74,7 @@ test('with module & parent-dir templates', function () { }); -test('with module & without subdir templates', function () { +test('Module-specific template file hierarchy', function () { $presenter = new CPresenter; $presenter->setParent(null, 'Module:Two'); $presenter->setView('view'); diff --git a/tests/UI/Presenter.initGlobalParameters().phpt b/tests/UI/Presenter.initGlobalParameters().phpt index f5b793fe3..67fea5a30 100644 --- a/tests/UI/Presenter.initGlobalParameters().phpt +++ b/tests/UI/Presenter.initGlobalParameters().phpt @@ -42,7 +42,7 @@ function createPresenter() } -test('signal in GET', function () { +test('Signal parsing from GET parameters', function () { $presenter = createPresenter(); $presenter->run(new Application\Request('Foo', 'GET', [ 'do' => 'foo', @@ -50,7 +50,7 @@ test('signal in GET', function () { Assert::same(['', 'foo'], $presenter->getSignal()); }); -test('signal for subcomponent in GET', function () { +test('Compound signal name handling', function () { $presenter = createPresenter(); $presenter->run(new Application\Request('Foo', 'GET', [ 'do' => 'foo-bar', @@ -58,7 +58,7 @@ test('signal for subcomponent in GET', function () { Assert::same(['foo', 'bar'], $presenter->getSignal()); }); -test('signal in POST', function () { +test('POST signal without CSRF protection', function () { $presenter = createPresenter(); $presenter->run(new Application\Request('Foo', 'POST', [], [ 'do' => 'foo', @@ -66,7 +66,7 @@ test('signal in POST', function () { Assert::null($presenter->getSignal()); }); -test('_signal_ in POST', function () { +test('POST signal with CSRF protection', function () { $presenter = createPresenter(); $presenter->run(new Application\Request('Foo', 'POST', [], [ '_do' => 'foo', @@ -74,7 +74,7 @@ test('_signal_ in POST', function () { Assert::same(['', 'foo'], $presenter->getSignal()); }); -test('signal in POST not overwriting GET', function () { +test('Conflicting signal parameters resolution', function () { $presenter = createPresenter(); $presenter->run(new Application\Request('Foo', 'POST', ['do' => null], [ 'do' => 'foo', @@ -82,7 +82,7 @@ test('signal in POST not overwriting GET', function () { Assert::null($presenter->getSignal()); }); -test('_signal_ in POST overwriting GET', function () { +test('POST signal priority over GET', function () { $presenter = createPresenter(); $presenter->run(new Application\Request('Foo', 'POST', ['do' => 'bar'], [ '_do' => 'foo', @@ -90,7 +90,7 @@ test('_signal_ in POST overwriting GET', function () { Assert::same(['', 'foo'], $presenter->getSignal()); }); -test('AJAX: signal in POST', function () { +test('AJAX signal handling in POST', function () { $presenter = createPresenter(); $presenter->ajax = true; $presenter->run(new Application\Request('Foo', 'POST', [], [ @@ -99,7 +99,7 @@ test('AJAX: signal in POST', function () { Assert::same(['', 'foo'], $presenter->getSignal()); }); -test('AJAX: signal in POST overwriting GET', function () { +test('AJAX signal override in POST data', function () { $presenter = createPresenter(); $presenter->ajax = true; $presenter->run(new Application\Request('Foo', 'POST', ['do' => 'bar'], [ @@ -108,7 +108,7 @@ test('AJAX: signal in POST overwriting GET', function () { Assert::same(['', 'foo'], $presenter->getSignal()); }); -test('AJAX: _signal_ in POST overwriting GET', function () { +test('AJAX with explicit CSRF-protected signal', function () { $presenter = createPresenter(); $presenter->ajax = true; $presenter->run(new Application\Request('Foo', 'POST', ['do' => 'bar'], [ diff --git a/tests/UI/Presenter.isModuleCurrent().phpt b/tests/UI/Presenter.isModuleCurrent().phpt index 6f9f23b89..dc59eb09b 100644 --- a/tests/UI/Presenter.isModuleCurrent().phpt +++ b/tests/UI/Presenter.isModuleCurrent().phpt @@ -16,7 +16,7 @@ class TestPresenter extends Nette\Application\UI\Presenter } -test('', function () { +test('Root module current status check', function () { $presenter = new TestPresenter; $presenter->setParent(null, 'Test'); @@ -26,7 +26,7 @@ test('', function () { }); -test('', function () { +test('Nested module hierarchy validation', function () { $presenter = new TestPresenter; $presenter->setParent(null, 'First:Second:Third:Test'); diff --git a/tests/UI/Presenter.storeRequest().phpt b/tests/UI/Presenter.storeRequest().phpt index 2c09538d5..106c0fc17 100644 --- a/tests/UI/Presenter.storeRequest().phpt +++ b/tests/UI/Presenter.storeRequest().phpt @@ -23,7 +23,7 @@ class TestPresenter extends Application\UI\Presenter } -test('ok', function () { +test('Request storage with user context', function () { $testedKeyExistence = $storedKey = $storedValue = $testExpiration = $testExpirationVariables = null; $sessionSectionMock = Mockery::mock(Nette\Http\SessionSection::class); @@ -79,7 +79,7 @@ test('ok', function () { }); -test('no user', function () { +test('Request storage without user context', function () { $testedKeyExistence = $storedKey = $storedValue = $testExpiration = $testExpirationVariables = null; $sessionSectionMock = Mockery::mock(Nette\Http\SessionSection::class);