adrema/tests/Fileshare/FileshareIndexActionTest.php

44 lines
2.1 KiB
PHP
Raw Normal View History

2024-06-27 00:00:29 +02:00
<?php
namespace Tests\Fileshare;
use App\Fileshare\ConnectionTypes\OwncloudConnection;
2024-06-27 17:41:54 +02:00
use App\Fileshare\Models\Fileshare;
2024-06-27 00:00:29 +02:00
use Tests\FileshareTestCase;
2024-06-27 12:48:20 +02:00
class FileshareIndexActionTest extends FileshareTestCase
2024-06-27 00:00:29 +02:00
{
public function testItListsOwncloudConnectionsThatAreActive(): void
{
$this->withoutExceptionHandling()->login()->loginNami()->withOwncloudUser('badenpowell', 'secret');
2024-06-27 17:41:54 +02:00
$connection = Fileshare::factory()
2024-06-27 00:00:29 +02:00
->type(OwncloudConnection::from(['user' => 'badenpowell', 'password' => 'secret', 'base_url' => env('TEST_OWNCLOUD_DOMAIN')]))
->name('lokaler Server')
->create();
$this->get('/setting/fileshare')
->assertInertiaPath('data.data.0.name', 'lokaler Server')
2024-06-27 00:05:23 +02:00
->assertInertiaPath('data.data.0.type', OwncloudConnection::class)
->assertInertiaPath('data.data.0.config.user', 'badenpowell')
->assertInertiaPath('data.data.0.config.password', 'secret')
->assertInertiaPath('data.data.0.config.base_url', env('TEST_OWNCLOUD_DOMAIN'))
->assertInertiaPath('data.data.0.id', $connection->id)
2024-06-27 11:35:10 +02:00
->assertInertiaPath('data.data.0.is_active', true)
->assertInertiaPath('data.data.0.type_human', 'Owncloud')
2024-06-27 12:48:20 +02:00
->assertInertiaPath('data.data.0.links.update', route('fileshare.update', ['fileshare' => $connection]))
2024-06-27 11:35:10 +02:00
->assertInertiaPath('data.meta.default.name', '')
->assertInertiaPath('data.meta.links.store', route('fileshare.store'))
->assertInertiaPath('data.meta.types.0.id', OwncloudConnection::class)
->assertInertiaPath('data.meta.types.0.name', 'Owncloud')
->assertInertiaPath('data.meta.types.0.defaults.base_url', '')
->assertInertiaPath('data.meta.types.0.fields.1', ['label' => 'Benutzer', 'key' => 'user', 'type' => 'text']);
2024-06-27 00:00:29 +02:00
}
2024-06-27 17:50:18 +02:00
public function testItRendersComponent(): void
{
$this->withoutExceptionHandling()->login()->loginNami();
$this->get('/setting/fileshare')->assertComponent('fileshareconnection/Index');
}
2024-06-27 00:00:29 +02:00
}