43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit\Data;
|
|
|
|
use App\Features\WebDav\Data\WebDavAccountData;
|
|
use PHPUnit\Framework\Attributes\Test;
|
|
use Tests\TestCase;
|
|
|
|
class WebDavAccountDataTest extends TestCase
|
|
{
|
|
#[Test]
|
|
public function it_can_be_created_from_array(): void
|
|
{
|
|
$data = WebDavAccountData::from([
|
|
'id' => 1,
|
|
'user_id' => 1,
|
|
'username' => 'testuser',
|
|
'display_name' => 'Test User',
|
|
'enabled' => true,
|
|
]);
|
|
|
|
$this->assertEquals(1, $data->id);
|
|
$this->assertEquals(1, $data->userId);
|
|
$this->assertEquals('testuser', $data->username);
|
|
$this->assertEquals('Test User', $data->displayName);
|
|
$this->assertTrue($data->enabled);
|
|
}
|
|
|
|
#[Test]
|
|
public function it_handles_disabled_account(): void
|
|
{
|
|
$data = WebDavAccountData::from([
|
|
'id' => 2,
|
|
'user_id' => 1,
|
|
'username' => 'disableduser',
|
|
'display_name' => 'Disabled User',
|
|
'enabled' => false,
|
|
]);
|
|
|
|
$this->assertFalse($data->enabled);
|
|
}
|
|
}
|