35 lines
2.0 KiB
PHP
35 lines
2.0 KiB
PHP
<?php
|
|
|
|
it('registers Slack module config endpoints and customer registration webhook config', function (): void {
|
|
$routeFile = app_path('routes/moduleConfigRoute.php');
|
|
$routeContent = file_get_contents($routeFile);
|
|
|
|
expect($routeContent)->not->toBeFalse()
|
|
->and($routeContent)->toContain('/slack/config')
|
|
->and($routeContent)->toContain("requirePermission('slack_config')")
|
|
->and($routeContent)->toContain("(new slack())->getConfig()->getConfigRequest()")
|
|
->and($routeContent)->toContain("(new slack())->getConfig()->postConfigRequest()");
|
|
|
|
$moduleContent = file_get_contents(app_path('modules/slack/slack_c.php'));
|
|
$variableContent = file_get_contents(app_path('modules/slack/config/slack_customer_registration_webhook_url_c.php'));
|
|
$slackClassContent = file_get_contents(app_path('classes/slack.php'));
|
|
$authRouteContent = file_get_contents(app_path('routes/authRoute.php'));
|
|
$openApiContent = file_get_contents(app_path('openapi.yaml'));
|
|
|
|
expect($moduleContent)->not->toBeFalse()
|
|
->and($moduleContent)->toContain("setupConfig('Slack')")
|
|
->and($moduleContent)->toContain('slack_customer_registration_webhook_url_c::class')
|
|
->and($variableContent)->not->toBeFalse()
|
|
->and($variableContent)->toContain("'customer_registration_webhook_url'")
|
|
->and($variableContent)->toContain('Slack webhook URL used for successful customer registration notifications')
|
|
->and($slackClassContent)->not->toBeFalse()
|
|
->and($slackClassContent)->toContain('send_customer_registration_notification')
|
|
->and($slackClassContent)->toContain('format_customer_registration')
|
|
->and($authRouteContent)->not->toBeFalse()
|
|
->and($authRouteContent)->toContain("AUTH_REGISTER_CVR_SLACK_NOTIFICATION_FAILED")
|
|
->and($openApiContent)->not->toBeFalse()
|
|
->and($openApiContent)->toContain('/slack/config')
|
|
->and($openApiContent)->toContain('SlackConfigListResponse')
|
|
->and($openApiContent)->toContain('SlackConfigEntry');
|
|
});
|