SmsFrameworkIncomingRouteTest.php in SMS Framework 2.x
File
tests/src/Kernel/SmsFrameworkIncomingRouteTest.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Tests\sms\Kernel;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
class SmsFrameworkIncomingRouteTest extends SmsFrameworkKernelBase {
public static $modules = [
'system',
'sms',
'entity_test',
'user',
'field',
'telephone',
'dynamic_entity_reference',
'sms_test_gateway',
'basic_auth',
];
protected $routeProvider;
protected $incomingGateway;
protected function setUp() {
parent::setUp();
$this->routeProvider = $this->container
->get('router.route_provider');
}
public function testIncomingRouteUnsupported() {
$gateway = $this
->createMemoryGateway([
'plugin' => 'capabilities_default',
]);
$this
->expectException(RouteNotFoundException::class);
$route = 'sms.incoming.receive.' . $gateway
->id();
$this->routeProvider
->getRouteByName($route);
}
public function testIncomingRoute() {
$incoming_gateway = $this
->createMemoryGateway([
'plugin' => 'incoming',
]);
$name = 'sms.incoming.receive.' . $incoming_gateway
->id();
$route = $this->routeProvider
->getRouteByName($name);
$this
->assertEquals($incoming_gateway
->getPushIncomingPath(), $route
->getPath());
}
}