diff --git a/src/Application/PresenterFactory.php b/src/Application/PresenterFactory.php index 225f04768..af7203fdf 100644 --- a/src/Application/PresenterFactory.php +++ b/src/Application/PresenterFactory.php @@ -19,7 +19,7 @@ class PresenterFactory implements IPresenterFactory { /** @var array[] of module => splited mask */ private array $mapping = [ - '*' => ['', '*Module\\', '*Presenter'], + '*' => ['App\\UI\\', '*\\', '**Presenter'], 'Nette' => ['NetteModule\\', '*\\', '*Presenter'], ]; diff --git a/tests/Application/PresenterFactory.formatPresenterClass.phpt b/tests/Application/PresenterFactory.formatPresenterClass.phpt index 3ef876bb9..1c3073a29 100644 --- a/tests/Application/PresenterFactory.formatPresenterClass.phpt +++ b/tests/Application/PresenterFactory.formatPresenterClass.phpt @@ -21,11 +21,11 @@ test('defined module', function () { 'Foo3' => 'My\App\*Mod\*Presenter', ]); - Assert::same('FooPresenter', $factory->formatPresenterClass('Foo')); - Assert::same('FooModule\BarPresenter', $factory->formatPresenterClass('Foo:Bar')); - Assert::same('FooModule\BarModule\BazPresenter', $factory->formatPresenterClass('Foo:Bar:Baz')); + Assert::same('App\UI\Foo\FooPresenter', $factory->formatPresenterClass('Foo')); + Assert::same('App\UI\Foo\Bar\BarPresenter', $factory->formatPresenterClass('Foo:Bar')); + Assert::same('App\UI\Foo\Bar\Baz\BazPresenter', $factory->formatPresenterClass('Foo:Bar:Baz')); - Assert::same('Foo2Presenter', $factory->formatPresenterClass('Foo2')); + Assert::same('App\UI\Foo2\Foo2Presenter', $factory->formatPresenterClass('Foo2')); Assert::same('App2\BarPresenter', $factory->formatPresenterClass('Foo2:Bar')); Assert::same('App2\Bar\BazPresenter', $factory->formatPresenterClass('Foo2:Bar:Baz')); @@ -44,7 +44,7 @@ test('auto module', function () { 'Foo3' => 'My\App\*Presenter', ]); - Assert::same('Foo2Presenter', $factory->formatPresenterClass('Foo2')); + Assert::same('App\UI\Foo2\Foo2Presenter', $factory->formatPresenterClass('Foo2')); Assert::same('App2\BarPresenter', $factory->formatPresenterClass('Foo2:Bar')); Assert::same('App2\BarModule\BazPresenter', $factory->formatPresenterClass('Foo2:Bar:Baz')); @@ -61,11 +61,11 @@ test('location ** & defined module', function () { 'Foo3' => 'My\App\*Mod\**Presenter', ]); - Assert::same('FooPresenter', $factory->formatPresenterClass('Foo')); - Assert::same('FooModule\BarPresenter', $factory->formatPresenterClass('Foo:Bar')); - Assert::same('FooModule\BarModule\BazPresenter', $factory->formatPresenterClass('Foo:Bar:Baz')); + Assert::same('App\UI\Foo\FooPresenter', $factory->formatPresenterClass('Foo')); + Assert::same('App\UI\Foo\Bar\BarPresenter', $factory->formatPresenterClass('Foo:Bar')); + Assert::same('App\UI\Foo\Bar\Baz\BazPresenter', $factory->formatPresenterClass('Foo:Bar:Baz')); - Assert::same('Foo2Presenter', $factory->formatPresenterClass('Foo2')); + Assert::same('App\UI\Foo2\Foo2Presenter', $factory->formatPresenterClass('Foo2')); Assert::same('App2\Bar\BarPresenter', $factory->formatPresenterClass('Foo2:Bar')); Assert::same('App2\Bar\Baz\BazPresenter', $factory->formatPresenterClass('Foo2:Bar:Baz')); diff --git a/tests/Routers/LinkGenerator.phpt b/tests/Routers/LinkGenerator.phpt index 6761e67a9..f71a30b96 100644 --- a/tests/Routers/LinkGenerator.phpt +++ b/tests/Routers/LinkGenerator.phpt @@ -6,7 +6,9 @@ declare(strict_types=1); -namespace { +namespace App\UI\Homepage { + + use Nette; require __DIR__ . '/../bootstrap.php'; @@ -24,7 +26,7 @@ namespace { } -namespace ModuleModule { +namespace App\UI\Module\My { use Nette; diff --git a/tests/Routers/link-aliases.phpt b/tests/Routers/link-aliases.phpt index 0f2b75324..2180bd526 100644 --- a/tests/Routers/link-aliases.phpt +++ b/tests/Routers/link-aliases.phpt @@ -20,6 +20,7 @@ class TestPresenter extends Application\UI\Presenter $factory = new PresenterFactory; +$factory->setMapping(['*' => '*Presenter']); $factory->setAliases([ 'a' => 'Test:a', 'b' => 'Test:b',