PHP Classes

File: tests/Feature/WebhookRouteConfigTest.php

Recommend this page to a friend!
  Packages of Daryl Legion   PayRex Laravel   tests/Feature/WebhookRouteConfigTest.php   Download  
File: tests/Feature/WebhookRouteConfigTest.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PayRex Laravel
Request payments using the PayRex service
Author: By
Last change:
Date: 13 days ago
Size: 856 bytes
 

Contents

Class file image Download
<?php

declare(strict_types=1);

use
Illuminate\Routing\RouteCollection;
use
Illuminate\Support\Facades\Route;
use
LegionHQ\LaravelPayrex\PayrexServiceProvider;

it('registers webhook route when enabled', function () {
   
expect(Route::has('payrex.webhook'))->toBeTrue();
});

it('uses the default webhook path', function () {
   
$route = Route::getRoutes()->getByName('payrex.webhook');

   
expect($route)->not->toBeNull()
        ->
and($route->uri())->toBe('payrex/webhook');
});

it('does not register webhook route when disabled', function () {
   
config(['payrex.webhook.enabled' => false]);

   
// Clear all routes and re-boot only the package's route registration
   
$this->app['router']->setRoutes(new RouteCollection);
    (new
PayrexServiceProvider($this->app))->packageBooted();

   
expect(Route::has('payrex.webhook'))->toBeFalse();
});