mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-19 01:41:36 +00:00
fix notification chanels and more tests (#108)
* fix notification chanels and more tests * fix code style
This commit is contained in:
parent
b75df8e1c5
commit
f70963d6bb
@ -8,12 +8,12 @@
|
||||
class Notifier
|
||||
{
|
||||
/**
|
||||
* In the future we can send notifications based on the notifiable instance
|
||||
* In the future we can send notifications based on the notifiable instance,
|
||||
* For example, If it was a server then we will send the channels specified by that server
|
||||
* For now, we will send all channels.
|
||||
*/
|
||||
public function send(object $notifiable, Notification $notification): void
|
||||
{
|
||||
// NotificationChannel::notifyAll($notification);
|
||||
NotificationChannel::notifyAll($notification);
|
||||
}
|
||||
}
|
||||
|
@ -7,11 +7,6 @@
|
||||
|
||||
class Discord extends AbstractNotificationChannel
|
||||
{
|
||||
public function channel(): string
|
||||
{
|
||||
return 'discord';
|
||||
}
|
||||
|
||||
public function createRules(array $input): array
|
||||
{
|
||||
return [
|
||||
|
@ -35,7 +35,10 @@ public function connect(): bool
|
||||
{
|
||||
try {
|
||||
Mail::to($this->data()['email'])->send(
|
||||
new NotificationMail('Test VitoDeploy', 'This is a test email!')
|
||||
new NotificationMail(
|
||||
'Connected to VitoDeploy',
|
||||
'This email confirms that you have connected your email to VitoDeploy.'
|
||||
)
|
||||
);
|
||||
} catch (Throwable) {
|
||||
return false;
|
||||
|
@ -7,11 +7,6 @@
|
||||
|
||||
class Slack extends AbstractNotificationChannel
|
||||
{
|
||||
public function channel(): string
|
||||
{
|
||||
return 'slack';
|
||||
}
|
||||
|
||||
public function createRules(array $input): array
|
||||
{
|
||||
return [
|
||||
|
@ -10,11 +10,6 @@ class Telegram extends AbstractNotificationChannel
|
||||
{
|
||||
protected string $apiUrl = 'https://api.telegram.org/bot';
|
||||
|
||||
public function channel(): string
|
||||
{
|
||||
return 'telegram';
|
||||
}
|
||||
|
||||
public function createRules(array $input): array
|
||||
{
|
||||
return [
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Contracts\Notification as NotificationInterface;
|
||||
use App\Models\NotificationChannel;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
@ -13,9 +14,16 @@ abstract class AbstractNotification extends Notification implements Notification
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public function via(object $notifiable): string
|
||||
{
|
||||
/** @var NotificationChannel $notifiable */
|
||||
return get_class($notifiable->provider());
|
||||
}
|
||||
|
||||
public function toMail(object $notifiable): MailMessage
|
||||
{
|
||||
return (new MailMessage())
|
||||
->subject('Notification')
|
||||
->line($this->rawText());
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ public function install(): void
|
||||
'server' => $this->server,
|
||||
])
|
||||
);
|
||||
// Notifier::send($this->server, new ServerInstallationSucceed($this->server));
|
||||
Notifier::send($this->server, new ServerInstallationSucceed($this->server));
|
||||
};
|
||||
|
||||
Bus::chain($jobs)
|
||||
|
@ -2,9 +2,7 @@
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"queue:listen": "php artisan queue:listen --timeout=600 --queue=default,ssh,ssh-long",
|
||||
"scheduler:run": "php artisan schedule:run"
|
||||
"build": "vite build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ryangjchandler/alpine-clipboard": "^2.2.0",
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Http;
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Http\Livewire\Application\AutoDeployment;
|
||||
use App\Http\Livewire\Application\ChangeBranch;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Http\Auth;
|
||||
namespace Tests\Feature\Auth;
|
||||
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Http\Auth;
|
||||
namespace Tests\Feature\Auth;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Http\Auth;
|
||||
namespace Tests\Feature\Auth;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use JsonException;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Http\Auth;
|
||||
namespace Tests\Feature\Auth;
|
||||
|
||||
use Illuminate\Auth\Notifications\ResetPassword;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Http\Auth;
|
||||
namespace Tests\Feature\Auth;
|
||||
|
||||
use App\Http\Livewire\Profile\UpdatePassword;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Http;
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Enums\CronjobStatus;
|
||||
use App\Http\Livewire\Cronjobs\CreateCronjob;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Http;
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Enums\BackupStatus;
|
||||
use App\Facades\SSH;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Http;
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Enums\DatabaseStatus;
|
||||
use App\Facades\SSH;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Http;
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Enums\DatabaseUserStatus;
|
||||
use App\Http\Livewire\Databases\DatabaseUserList;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Http;
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Enums\FirewallRuleStatus;
|
||||
use App\Http\Livewire\Firewall\CreateFirewallRule;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Http;
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Http\Livewire\ServerLogs\LogsList;
|
||||
use App\Models\ServerLog;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Http;
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Enums\NotificationChannel;
|
||||
use App\Http\Livewire\NotificationChannels\AddChannel;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Http;
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Enums\ServiceStatus;
|
||||
use App\Http\Livewire\Php\DefaultCli;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Http;
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Http\Livewire\Profile\UpdatePassword;
|
||||
use App\Http\Livewire\Profile\UpdateProfileInformation;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Feature\Http;
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Http\Livewire\Projects\CreateProject;
|
||||
use App\Http\Livewire\Projects\EditProject;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Http;
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Enums\QueueStatus;
|
||||
use App\Http\Livewire\Queues\CreateQueue;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Http;
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Enums\SshKeyStatus;
|
||||
use App\Http\Livewire\ServerSshKeys\AddExistingKey;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Http;
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Enums\ServerProvider;
|
||||
use App\Http\Livewire\ServerProviders\ConnectProvider;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Http;
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Enums\Database;
|
||||
use App\Enums\OperatingSystem;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Http;
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Enums\ServiceStatus;
|
||||
use App\Http\Livewire\Services\InstallPHPMyAdmin;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Http;
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Enums\SiteStatus;
|
||||
use App\Enums\SiteType;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Http;
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Http\Livewire\SourceControls\Connect;
|
||||
use App\Http\Livewire\SourceControls\SourceControlsList;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Http;
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Http\Livewire\SshKeys\AddKey;
|
||||
use App\Http\Livewire\SshKeys\KeysList;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Http;
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Enums\SslStatus;
|
||||
use App\Enums\SslType;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Http;
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Enums\StorageProvider;
|
||||
use App\Http\Livewire\StorageProviders\ConnectProvider;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Models;
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
87
tests/Unit/NotificationChannels/DiscordTest.php
Normal file
87
tests/Unit/NotificationChannels/DiscordTest.php
Normal file
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\NotificationChannels;
|
||||
|
||||
use App\Models\NotificationChannel;
|
||||
use App\NotificationChannels\Discord;
|
||||
use Illuminate\Http\Client\Request;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Tests\TestCase;
|
||||
|
||||
class DiscordTest extends TestCase
|
||||
{
|
||||
public function test_create_rules(): void
|
||||
{
|
||||
$provider = new Discord(NotificationChannel::factory()->create([
|
||||
'provider' => 'discord',
|
||||
]));
|
||||
|
||||
$this->assertSame([
|
||||
'webhook_url' => 'required|url',
|
||||
], $provider->createRules([]));
|
||||
}
|
||||
|
||||
public function test_create_data(): void
|
||||
{
|
||||
$provider = new Discord(NotificationChannel::factory()->create([
|
||||
'provider' => 'discord',
|
||||
]));
|
||||
|
||||
$this->assertSame([
|
||||
'webhook_url' => 'https://discord.com/xxxxx',
|
||||
], $provider->createData([
|
||||
'webhook_url' => 'https://discord.com/xxxxx',
|
||||
]));
|
||||
}
|
||||
|
||||
public function test_data(): void
|
||||
{
|
||||
$provider = new Discord(NotificationChannel::factory()->create([
|
||||
'provider' => 'discord',
|
||||
'data' => [
|
||||
'webhook_url' => 'https://discord.com/xxxxx',
|
||||
],
|
||||
]));
|
||||
|
||||
$this->assertSame([
|
||||
'webhook_url' => 'https://discord.com/xxxxx',
|
||||
], $provider->data());
|
||||
}
|
||||
|
||||
public function test_connect(): void
|
||||
{
|
||||
$provider = new Discord(NotificationChannel::factory()->create([
|
||||
'provider' => 'discord',
|
||||
'data' => [
|
||||
'webhook_url' => 'https://discord.com/xxxxx',
|
||||
],
|
||||
]));
|
||||
|
||||
Http::fake();
|
||||
|
||||
$this->assertTrue($provider->connect());
|
||||
|
||||
Http::assertSent(function ($request) {
|
||||
return $request->url() === 'https://discord.com/xxxxx';
|
||||
});
|
||||
}
|
||||
|
||||
public function test_send(): void
|
||||
{
|
||||
$channel = NotificationChannel::factory()->create([
|
||||
'provider' => 'discord',
|
||||
'data' => [
|
||||
'webhook_url' => 'https://discord.com/xxxxx',
|
||||
],
|
||||
]);
|
||||
$provider = new Discord($channel);
|
||||
|
||||
Http::fake();
|
||||
|
||||
$provider->send($channel, new TestNotification());
|
||||
|
||||
Http::assertSent(function (Request $request) {
|
||||
return $request->body() === '{"content":"Hello"}';
|
||||
});
|
||||
}
|
||||
}
|
83
tests/Unit/NotificationChannels/EmailTest.php
Normal file
83
tests/Unit/NotificationChannels/EmailTest.php
Normal file
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\NotificationChannels;
|
||||
|
||||
use App\Mail\NotificationMail;
|
||||
use App\Models\NotificationChannel;
|
||||
use App\NotificationChannels\Email;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Tests\TestCase;
|
||||
|
||||
class EmailTest extends TestCase
|
||||
{
|
||||
public function test_create_rules(): void
|
||||
{
|
||||
$provider = new Email(NotificationChannel::factory()->create([
|
||||
'provider' => 'email',
|
||||
]));
|
||||
|
||||
$this->assertSame([
|
||||
'email' => 'required|email',
|
||||
], $provider->createRules([]));
|
||||
}
|
||||
|
||||
public function test_create_data(): void
|
||||
{
|
||||
$provider = new Email(NotificationChannel::factory()->create([
|
||||
'provider' => 'email',
|
||||
]));
|
||||
|
||||
$this->assertSame([
|
||||
'email' => 'user@example.com',
|
||||
], $provider->createData([
|
||||
'email' => 'user@example.com',
|
||||
]));
|
||||
}
|
||||
|
||||
public function test_data(): void
|
||||
{
|
||||
$provider = new Email(NotificationChannel::factory()->create([
|
||||
'provider' => 'email',
|
||||
'data' => [
|
||||
'email' => 'user@example.com',
|
||||
],
|
||||
]));
|
||||
|
||||
$this->assertSame([
|
||||
'email' => 'user@example.com',
|
||||
], $provider->data());
|
||||
}
|
||||
|
||||
public function test_connect(): void
|
||||
{
|
||||
$provider = new Email(NotificationChannel::factory()->create([
|
||||
'provider' => 'email',
|
||||
'data' => [
|
||||
'email' => 'user@example.com',
|
||||
],
|
||||
]));
|
||||
|
||||
Mail::fake();
|
||||
|
||||
$this->assertTrue($provider->connect());
|
||||
|
||||
Mail::assertSent(NotificationMail::class);
|
||||
}
|
||||
|
||||
public function test_send(): void
|
||||
{
|
||||
$channel = NotificationChannel::factory()->create([
|
||||
'provider' => 'email',
|
||||
'data' => [
|
||||
'email' => 'user@example.com',
|
||||
],
|
||||
]);
|
||||
$provider = new Email($channel);
|
||||
|
||||
Mail::fake();
|
||||
|
||||
$provider->send($channel, new TestNotification());
|
||||
|
||||
Mail::assertSent(NotificationMail::class);
|
||||
}
|
||||
}
|
87
tests/Unit/NotificationChannels/SlackTest.php
Normal file
87
tests/Unit/NotificationChannels/SlackTest.php
Normal file
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\NotificationChannels;
|
||||
|
||||
use App\Models\NotificationChannel;
|
||||
use App\NotificationChannels\Slack;
|
||||
use Illuminate\Http\Client\Request;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Tests\TestCase;
|
||||
|
||||
class SlackTest extends TestCase
|
||||
{
|
||||
public function test_create_rules(): void
|
||||
{
|
||||
$provider = new Slack(NotificationChannel::factory()->create([
|
||||
'provider' => 'slack',
|
||||
]));
|
||||
|
||||
$this->assertSame([
|
||||
'webhook_url' => 'required|url',
|
||||
], $provider->createRules([]));
|
||||
}
|
||||
|
||||
public function test_create_data(): void
|
||||
{
|
||||
$provider = new Slack(NotificationChannel::factory()->create([
|
||||
'provider' => 'slack',
|
||||
]));
|
||||
|
||||
$this->assertSame([
|
||||
'webhook_url' => 'https://slack.com/xxxxx',
|
||||
], $provider->createData([
|
||||
'webhook_url' => 'https://slack.com/xxxxx',
|
||||
]));
|
||||
}
|
||||
|
||||
public function test_data(): void
|
||||
{
|
||||
$provider = new Slack(NotificationChannel::factory()->create([
|
||||
'provider' => 'slack',
|
||||
'data' => [
|
||||
'webhook_url' => 'https://slack.com/xxxxx',
|
||||
],
|
||||
]));
|
||||
|
||||
$this->assertSame([
|
||||
'webhook_url' => 'https://slack.com/xxxxx',
|
||||
], $provider->data());
|
||||
}
|
||||
|
||||
public function test_connect(): void
|
||||
{
|
||||
$provider = new Slack(NotificationChannel::factory()->create([
|
||||
'provider' => 'slack',
|
||||
'data' => [
|
||||
'webhook_url' => 'https://slack.com/xxxxx',
|
||||
],
|
||||
]));
|
||||
|
||||
Http::fake();
|
||||
|
||||
$this->assertTrue($provider->connect());
|
||||
|
||||
Http::assertSent(function ($request) {
|
||||
return $request->url() === 'https://slack.com/xxxxx';
|
||||
});
|
||||
}
|
||||
|
||||
public function test_send(): void
|
||||
{
|
||||
$channel = NotificationChannel::factory()->create([
|
||||
'provider' => 'slack',
|
||||
'data' => [
|
||||
'webhook_url' => 'https://slack.com/xxxxx',
|
||||
],
|
||||
]);
|
||||
$provider = new Slack($channel);
|
||||
|
||||
Http::fake();
|
||||
|
||||
$provider->send($channel, new TestNotification());
|
||||
|
||||
Http::assertSent(function (Request $request) {
|
||||
return $request->body() === '{"text":"Hello"}';
|
||||
});
|
||||
}
|
||||
}
|
108
tests/Unit/NotificationChannels/TelegramTest.php
Normal file
108
tests/Unit/NotificationChannels/TelegramTest.php
Normal file
@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\NotificationChannels;
|
||||
|
||||
use App\Models\NotificationChannel;
|
||||
use App\NotificationChannels\Telegram;
|
||||
use Illuminate\Http\Client\Request;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Tests\TestCase;
|
||||
|
||||
class TelegramTest extends TestCase
|
||||
{
|
||||
public function test_create_rules(): void
|
||||
{
|
||||
$provider = new Telegram(NotificationChannel::factory()->create([
|
||||
'provider' => 'telegram',
|
||||
]));
|
||||
|
||||
$this->assertSame([
|
||||
'bot_token' => 'required|string',
|
||||
'chat_id' => 'required',
|
||||
], $provider->createRules([]));
|
||||
}
|
||||
|
||||
public function test_create_data(): void
|
||||
{
|
||||
$provider = new Telegram(NotificationChannel::factory()->create([
|
||||
'provider' => 'telegram',
|
||||
]));
|
||||
|
||||
$this->assertSame([
|
||||
'bot_token' => 'xxxxx',
|
||||
'chat_id' => '12345',
|
||||
], $provider->createData([
|
||||
'bot_token' => 'xxxxx',
|
||||
'chat_id' => '12345',
|
||||
]));
|
||||
}
|
||||
|
||||
public function test_data(): void
|
||||
{
|
||||
$provider = new Telegram(NotificationChannel::factory()->create([
|
||||
'provider' => 'telegram',
|
||||
'data' => [
|
||||
'bot_token' => 'xxxxx',
|
||||
'chat_id' => '12345',
|
||||
],
|
||||
]));
|
||||
|
||||
$this->assertSame([
|
||||
'bot_token' => 'xxxxx',
|
||||
'chat_id' => '12345',
|
||||
], $provider->data());
|
||||
}
|
||||
|
||||
public function test_connect(): void
|
||||
{
|
||||
$provider = new Telegram(NotificationChannel::factory()->create([
|
||||
'provider' => 'telegram',
|
||||
'data' => [
|
||||
'bot_token' => 'xxxxx',
|
||||
'chat_id' => '12345',
|
||||
],
|
||||
]));
|
||||
|
||||
Http::fake();
|
||||
|
||||
$this->assertTrue($provider->connect());
|
||||
|
||||
Http::assertSent(function ($request) {
|
||||
if ($request->url() === 'https://api.telegram.org/botxxxxx/sendMessage') {
|
||||
return $request->data() === [
|
||||
'chat_id' => '12345',
|
||||
'text' => 'Connected!',
|
||||
'parse_mode' => 'markdown',
|
||||
'disable_web_page_preview' => true,
|
||||
];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function test_send(): void
|
||||
{
|
||||
$channel = NotificationChannel::factory()->create([
|
||||
'provider' => 'telegram',
|
||||
'data' => [
|
||||
'bot_token' => 'xxxxx',
|
||||
'chat_id' => '12345',
|
||||
],
|
||||
]);
|
||||
$provider = new Telegram($channel);
|
||||
|
||||
Http::fake();
|
||||
|
||||
$provider->send($channel, new TestNotification());
|
||||
|
||||
Http::assertSent(function (Request $request) {
|
||||
if ($request->url() === 'https://api.telegram.org/botxxxxx/sendMessage') {
|
||||
return $request->data() === [
|
||||
'chat_id' => '12345',
|
||||
'text' => 'Hello',
|
||||
'parse_mode' => 'markdown',
|
||||
'disable_web_page_preview' => true,
|
||||
];
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
13
tests/Unit/NotificationChannels/TestNotification.php
Normal file
13
tests/Unit/NotificationChannels/TestNotification.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\NotificationChannels;
|
||||
|
||||
use App\Notifications\AbstractNotification;
|
||||
|
||||
class TestNotification extends AbstractNotification
|
||||
{
|
||||
public function rawText(): string
|
||||
{
|
||||
return 'Hello';
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\CronJob;
|
||||
namespace Tests\Unit\SSHCommands\CronJob;
|
||||
|
||||
use App\SSHCommands\CronJob\UpdateCronJobsCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Database;
|
||||
namespace Tests\Unit\SSHCommands\Database;
|
||||
|
||||
use App\SSHCommands\Database\BackupDatabaseCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Database;
|
||||
namespace Tests\Unit\SSHCommands\Database;
|
||||
|
||||
use App\SSHCommands\Database\CreateCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Database;
|
||||
namespace Tests\Unit\SSHCommands\Database;
|
||||
|
||||
use App\SSHCommands\Database\CreateUserCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Database;
|
||||
namespace Tests\Unit\SSHCommands\Database;
|
||||
|
||||
use App\SSHCommands\Database\DeleteCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Database;
|
||||
namespace Tests\Unit\SSHCommands\Database;
|
||||
|
||||
use App\SSHCommands\Database\DeleteUserCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Database;
|
||||
namespace Tests\Unit\SSHCommands\Database;
|
||||
|
||||
use App\SSHCommands\Database\InstallMariadbCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Database;
|
||||
namespace Tests\Unit\SSHCommands\Database;
|
||||
|
||||
use App\SSHCommands\Database\InstallMysqlCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Database;
|
||||
namespace Tests\Unit\SSHCommands\Database;
|
||||
|
||||
use App\SSHCommands\Database\LinkCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Database;
|
||||
namespace Tests\Unit\SSHCommands\Database;
|
||||
|
||||
use App\SSHCommands\Database\UnlinkCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Firewall;
|
||||
namespace Tests\Unit\SSHCommands\Firewall;
|
||||
|
||||
use App\SSHCommands\Firewall\AddRuleCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Firewall;
|
||||
namespace Tests\Unit\SSHCommands\Firewall;
|
||||
|
||||
use App\SSHCommands\Firewall\InstallUfwCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Firewall;
|
||||
namespace Tests\Unit\SSHCommands\Firewall;
|
||||
|
||||
use App\SSHCommands\Firewall\RemoveRuleCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Installation;
|
||||
namespace Tests\Unit\SSHCommands\Installation;
|
||||
|
||||
use App\SSHCommands\Installation\InstallNodejsCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Installation;
|
||||
namespace Tests\Unit\SSHCommands\Installation;
|
||||
|
||||
use App\SSHCommands\Installation\InstallRedisCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Installation;
|
||||
namespace Tests\Unit\SSHCommands\Installation;
|
||||
|
||||
use App\SSHCommands\Installation\InstallRequirementsCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Nginx;
|
||||
namespace Tests\Unit\SSHCommands\Nginx;
|
||||
|
||||
use App\SSHCommands\Nginx\ChangeNginxPHPVersionCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Nginx;
|
||||
namespace Tests\Unit\SSHCommands\Nginx;
|
||||
|
||||
use App\SSHCommands\Nginx\CreateNginxVHostCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Nginx;
|
||||
namespace Tests\Unit\SSHCommands\Nginx;
|
||||
|
||||
use App\SSHCommands\Nginx\DeleteNginxSiteCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Nginx;
|
||||
namespace Tests\Unit\SSHCommands\Nginx;
|
||||
|
||||
use App\SSHCommands\Nginx\InstallNginxCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Nginx;
|
||||
namespace Tests\Unit\SSHCommands\Nginx;
|
||||
|
||||
use App\SSHCommands\Nginx\UpdateNginxRedirectsCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Nginx;
|
||||
namespace Tests\Unit\SSHCommands\Nginx;
|
||||
|
||||
use App\SSHCommands\Nginx\UpdateNginxVHostCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\PHP;
|
||||
namespace Tests\Unit\SSHCommands\PHP;
|
||||
|
||||
use App\SSHCommands\PHP\ChangeDefaultPHPCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\PHP;
|
||||
namespace Tests\Unit\SSHCommands\PHP;
|
||||
|
||||
use App\SSHCommands\PHP\GetPHPIniCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\PHP;
|
||||
namespace Tests\Unit\SSHCommands\PHP;
|
||||
|
||||
use App\SSHCommands\PHP\InstallComposerCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\PHP;
|
||||
namespace Tests\Unit\SSHCommands\PHP;
|
||||
|
||||
use App\SSHCommands\PHP\InstallPHPCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\PHP;
|
||||
namespace Tests\Unit\SSHCommands\PHP;
|
||||
|
||||
use App\SSHCommands\PHP\InstallPHPExtensionCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\PHP;
|
||||
namespace Tests\Unit\SSHCommands\PHP;
|
||||
|
||||
use App\SSHCommands\PHP\UninstallPHPCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\PHPMyAdmin;
|
||||
namespace Tests\Unit\SSHCommands\PHPMyAdmin;
|
||||
|
||||
use App\SSHCommands\PHPMyAdmin\CreateNginxPHPMyAdminVHostCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\PHPMyAdmin;
|
||||
namespace Tests\Unit\SSHCommands\PHPMyAdmin;
|
||||
|
||||
use App\SSHCommands\PHPMyAdmin\DeleteNginxPHPMyAdminVHostCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\PHPMyAdmin;
|
||||
namespace Tests\Unit\SSHCommands\PHPMyAdmin;
|
||||
|
||||
use App\SSHCommands\PHPMyAdmin\DownloadPHPMyAdminCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\SSL;
|
||||
namespace Tests\Unit\SSHCommands\SSL;
|
||||
|
||||
use App\SSHCommands\SSL\CreateCustomSSLCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\SSL;
|
||||
namespace Tests\Unit\SSHCommands\SSL;
|
||||
|
||||
use App\SSHCommands\SSL\CreateLetsencryptSSLCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\SSL;
|
||||
namespace Tests\Unit\SSHCommands\SSL;
|
||||
|
||||
use App\SSHCommands\SSL\InstallCertbotCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\SSL;
|
||||
namespace Tests\Unit\SSHCommands\SSL;
|
||||
|
||||
use App\SSHCommands\SSL\RemoveSSLCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Service;
|
||||
namespace Tests\Unit\SSHCommands\Service;
|
||||
|
||||
use App\SSHCommands\Service\RestartServiceCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Service;
|
||||
namespace Tests\Unit\SSHCommands\Service;
|
||||
|
||||
use App\SSHCommands\Service\ServiceStatusCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Service;
|
||||
namespace Tests\Unit\SSHCommands\Service;
|
||||
|
||||
use App\SSHCommands\Service\StartServiceCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Service;
|
||||
namespace Tests\Unit\SSHCommands\Service;
|
||||
|
||||
use App\SSHCommands\Service\StopServiceCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Storage;
|
||||
namespace Tests\Unit\SSHCommands\Storage;
|
||||
|
||||
use App\SSHCommands\Storage\DownloadFromDropboxCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Storage;
|
||||
namespace Tests\Unit\SSHCommands\Storage;
|
||||
|
||||
use App\SSHCommands\Storage\DownloadFromFTPCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Storage;
|
||||
namespace Tests\Unit\SSHCommands\Storage;
|
||||
|
||||
use App\SSHCommands\Storage\UploadToDropboxCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Storage;
|
||||
namespace Tests\Unit\SSHCommands\Storage;
|
||||
|
||||
use App\SSHCommands\Storage\UploadToFTPCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Supervisor;
|
||||
namespace Tests\Unit\SSHCommands\Supervisor;
|
||||
|
||||
use App\SSHCommands\Supervisor\CreateWorkerCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Supervisor;
|
||||
namespace Tests\Unit\SSHCommands\Supervisor;
|
||||
|
||||
use App\SSHCommands\Supervisor\DeleteWorkerCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Supervisor;
|
||||
namespace Tests\Unit\SSHCommands\Supervisor;
|
||||
|
||||
use App\SSHCommands\Supervisor\InstallSupervisorCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Supervisor;
|
||||
namespace Tests\Unit\SSHCommands\Supervisor;
|
||||
|
||||
use App\SSHCommands\Supervisor\RestartWorkerCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Supervisor;
|
||||
namespace Tests\Unit\SSHCommands\Supervisor;
|
||||
|
||||
use App\SSHCommands\Supervisor\StartWorkerCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\Supervisor;
|
||||
namespace Tests\Unit\SSHCommands\Supervisor;
|
||||
|
||||
use App\SSHCommands\Supervisor\StopWorkerCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\System;
|
||||
namespace Tests\Unit\SSHCommands\System;
|
||||
|
||||
use App\SSHCommands\System\CreateUserCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\System;
|
||||
namespace Tests\Unit\SSHCommands\System;
|
||||
|
||||
use App\SSHCommands\System\DeleteSshKeyCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\System;
|
||||
namespace Tests\Unit\SSHCommands\System;
|
||||
|
||||
use App\SSHCommands\System\DeploySshKeyCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\System;
|
||||
namespace Tests\Unit\SSHCommands\System;
|
||||
|
||||
use App\SSHCommands\System\EditFileCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\System;
|
||||
namespace Tests\Unit\SSHCommands\System;
|
||||
|
||||
use App\SSHCommands\System\GenerateSshKeyCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\System;
|
||||
namespace Tests\Unit\SSHCommands\System;
|
||||
|
||||
use App\SSHCommands\System\GetPublicKeyCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\System;
|
||||
namespace Tests\Unit\SSHCommands\System;
|
||||
|
||||
use App\SSHCommands\System\ReadFileCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\System;
|
||||
namespace Tests\Unit\SSHCommands\System;
|
||||
|
||||
use App\SSHCommands\System\ReadSshKeyCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\System;
|
||||
namespace Tests\Unit\SSHCommands\System;
|
||||
|
||||
use App\SSHCommands\System\RebootCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\System;
|
||||
namespace Tests\Unit\SSHCommands\System;
|
||||
|
||||
use App\SSHCommands\System\RunScriptCommand;
|
||||
use Tests\TestCase;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\SSHCommands\System;
|
||||
namespace Tests\Unit\SSHCommands\System;
|
||||
|
||||
use App\SSHCommands\System\UpgradeCommand;
|
||||
use Tests\TestCase;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user