adrema/tests/Lib/TestsDav.php

35 lines
1014 B
PHP

<?php
namespace Tests\Lib;
use App\User;
use Illuminate\Support\Facades\Hash;
use Illuminate\Testing\TestResponse;
trait TestsDav
{
public $davUserEmail = 'user@example.com';
public $davUserPassword = 'secret';
public function getDavCalendars(): TestResponse
{
$this->withBasicAuth($this->davUserEmail, $this->davUserPassword);
return $this->call('PROPFIND', '/dav/calendars/' . $this->davUserEmail, [], [], [], $this->transformHeadersToServerVars([]));
}
public function getDavCalendar(string $calendar): TestResponse
{
$this->withBasicAuth($this->davUserEmail, $this->davUserPassword);
return $this->call('PROPFIND', '/dav/calendars/' . $this->davUserEmail . '/' . $calendar, [], [], [], $this->transformHeadersToServerVars([]));
}
public function createDavUser(): self
{
$this->me = User::factory()->create(['email' => $this->davUserEmail, 'password' => Hash::make($this->davUserPassword)]);
return $this;
}
}