2024-06-30 21:04:54 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\Fileshare;
|
|
|
|
|
|
|
|
use App\Fileshare\ConnectionTypes\OwncloudConnection;
|
|
|
|
use App\Fileshare\Models\Fileshare;
|
|
|
|
use Tests\FileshareTestCase;
|
|
|
|
|
|
|
|
class AdapterTest extends FileshareTestCase
|
|
|
|
{
|
|
|
|
public function testItGetsFilesInRoot(): void
|
|
|
|
{
|
2024-07-14 00:05:53 +02:00
|
|
|
$this->withoutExceptionHandling()->login()->loginNami()->withUser('badenpowell', 'secret')
|
2024-06-30 21:04:54 +02:00
|
|
|
->withDirs('badenpowell', []);
|
|
|
|
|
|
|
|
$storage = OwncloudConnection::from(['user' => 'badenpowell', 'password' => 'secret', 'base_url' => env('TEST_OWNCLOUD_DOMAIN')])->getFilesystem();
|
|
|
|
$storage->put('/test.pdf', '');
|
|
|
|
$this->assertEquals(['test.pdf'], $storage->files('/'));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testItGetsFilesInSubdirectory(): void
|
|
|
|
{
|
2024-07-14 00:05:53 +02:00
|
|
|
$this->withoutExceptionHandling()->login()->loginNami()->withUser('badenpowell', 'secret')
|
2024-06-30 21:04:54 +02:00
|
|
|
->withDirs('badenpowell', ['/pictures']);
|
|
|
|
|
|
|
|
$storage = OwncloudConnection::from(['user' => 'badenpowell', 'password' => 'secret', 'base_url' => env('TEST_OWNCLOUD_DOMAIN')])->getFilesystem();
|
|
|
|
$storage->put('/pictures/test.pdf', '');
|
|
|
|
$this->assertEquals([], $storage->files('/'));
|
|
|
|
$this->assertEquals(['pictures/test.pdf'], $storage->files('/pictures'));
|
|
|
|
}
|
|
|
|
}
|