withoutExceptionHandling()->login()->loginNami()->withOwncloudUser('badenpowell', 'secret') ->withDirs('badenpowell', ['/pictures', '/lala']); $connection = Fileshare::factory() ->type(OwncloudConnection::from(['user' => 'badenpowell', 'password' => 'secret', 'base_url' => env('TEST_OWNCLOUD_DOMAIN')])) ->create(); $this->postJson(route('api.fileshare.files', ['fileshare' => $connection]), [ 'parent' => null, ]) ->assertJsonCount(2, 'data') ->assertJsonPath('data.0.name', 'lala') ->assertJsonPath('data.0.path', '/lala') ->assertJsonPath('data.0.parent', '/') ->assertJsonPath('data.1.name', 'pictures') ->assertJsonPath('data.1.path', '/pictures') ->assertJsonPath('data.1.parent', '/'); } public function testItGetsSubdirectories(): void { $this->withoutExceptionHandling()->login()->loginNami()->withOwncloudUser('badenpowell', 'secret') ->withDirs('badenpowell', ['/pictures', '/lala', '/lala/dd', '/lala/ff']); $connection = Fileshare::factory() ->type(OwncloudConnection::from(['user' => 'badenpowell', 'password' => 'secret', 'base_url' => env('TEST_OWNCLOUD_DOMAIN')])) ->create(); $this->postJson(route('api.fileshare.files', ['fileshare' => $connection]), ['parent' => '/pictures'])->assertJsonCount(0, 'data'); $this->postJson(route('api.fileshare.files', ['fileshare' => $connection]), ['parent' => '/lala']) ->assertJsonCount(2, 'data') ->assertJsonPath('data.0.name', 'dd') ->assertJsonPath('data.0.path', '/lala/dd') ->assertJsonPath('data.0.parent', '/lala') ->assertJsonPath('data.1.name', 'ff') ->assertJsonPath('data.1.path', '/lala/ff') ->assertJsonPath('data.1.parent', '/lala'); } public function testItGetsSubdirectoriesOfSubdirectory(): void { $this->withoutExceptionHandling()->login()->loginNami()->withOwncloudUser('badenpowell', 'secret') ->withDirs('badenpowell', ['/lala', '/lala/dd', '/lala/dd/ee']); $connection = Fileshare::factory() ->type(OwncloudConnection::from(['user' => 'badenpowell', 'password' => 'secret', 'base_url' => env('TEST_OWNCLOUD_DOMAIN')])) ->create(); $this->postJson(route('api.fileshare.files', ['fileshare' => $connection]), ['parent' => '/lala/dd']) ->assertJsonCount(1, 'data') ->assertJsonPath('data.0.name', 'ee') ->assertJsonPath('data.0.path', '/lala/dd/ee') ->assertJsonPath('data.0.parent', '/lala/dd'); } }