diff --git a/composer.json b/composer.json index 2726020..d67a921 100644 --- a/composer.json +++ b/composer.json @@ -43,12 +43,18 @@ "autoload": { "psr-4": { "Nutgram\\Laravel\\": "src/" - } + }, + "files": [ + "src/Support/Helpers.php" + ] }, "autoload-dev": { "psr-4": { "Nutgram\\Laravel\\Tests\\": "tests/" - } + }, + "files": [ + "src/Support/Helpers.php" + ] }, "extra": { "laravel": { diff --git a/src/Support/Helpers.php b/src/Support/Helpers.php new file mode 100644 index 0000000..dd8fb8c --- /dev/null +++ b/src/Support/Helpers.php @@ -0,0 +1,13 @@ +get('webAppData'); + } +} diff --git a/tests/Feature/MiddlewareTest.php b/tests/Feature/ValidateWebAppDataTest.php similarity index 95% rename from tests/Feature/MiddlewareTest.php rename to tests/Feature/ValidateWebAppDataTest.php index 0e6414a..e368571 100644 --- a/tests/Feature/MiddlewareTest.php +++ b/tests/Feature/ValidateWebAppDataTest.php @@ -6,6 +6,7 @@ use SergiX44\Nutgram\Telegram\Web\WebAppData; use SergiX44\Nutgram\Testing\FakeNutgram; use Symfony\Component\HttpKernel\Exception\HttpException; +use function Nutgram\Laravel\Support\webAppData; beforeEach(function () { /** @var FakeNutgram $bot */ @@ -24,6 +25,7 @@ $middleware = new ValidateWebAppData($this->bot); $middleware->handle($this->request, function ($request) { expect($request->get('webAppData'))->toBeInstanceOf(WebAppData::class); + expect(webAppData()); }); });