increase test coverage (#117)

70% test coverage
remove socialite
This commit is contained in:
Saeed Vaziry
2024-03-15 22:23:45 +01:00
committed by GitHub
parent 4f12de9586
commit a406491160
62 changed files with 1102 additions and 639 deletions

View File

@ -2,6 +2,7 @@
namespace App\Support\Testing;
use App\Exceptions\SSHConnectionError;
use App\Helpers\SSH;
use Illuminate\Support\Traits\ReflectsClosures;
use PHPUnit\Framework\Assert;
@ -14,11 +15,25 @@ class SSHFake extends SSH
protected ?string $output;
protected bool $connectionWillFail = false;
public function __construct(?string $output = null)
{
$this->output = $output;
}
public function connectionWillFail(): void
{
$this->connectionWillFail = true;
}
public function connect(bool $sftp = false): void
{
if ($this->connectionWillFail) {
throw new SSHConnectionError('Connection failed');
}
}
public function exec(string|array $commands, string $log = '', ?int $siteId = null): string
{
if ($log) {
@ -45,6 +60,11 @@ public function exec(string|array $commands, string $log = '', ?int $siteId = nu
return $output;
}
public function upload(string $local, string $remote): void
{
$this->log = null;
}
public function assertExecuted(array|string $commands): void
{
if (! $this->commands) {