64 lines
2.7 KiB
PHP
64 lines
2.7 KiB
PHP
<?php
|
|
|
|
namespace Modules\Fileshare\Components;
|
|
|
|
use App\Fileshare\ConnectionTypes\OwncloudConnection;
|
|
use App\Fileshare\Models\Fileshare;
|
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
|
use Livewire\Livewire;
|
|
use Modules\Fileshare\Components\SettingView;
|
|
use Tests\FileshareTestCase;
|
|
use Tests\TestCase;
|
|
|
|
uses(FileshareTestCase::class);
|
|
uses(DatabaseTransactions::class);
|
|
|
|
it('it renders page', function () {
|
|
test()->withoutExceptionHandling()->login()->loginNami();
|
|
|
|
test()->get('/setting/fileshare')->assertSeeLivewire(SettingView::class);
|
|
});
|
|
|
|
it('displays overview', function () {
|
|
$this->withoutExceptionHandling()->login()->loginNami()->withUser('badenpowell', 'secret');
|
|
Fileshare::factory()
|
|
->type(OwncloudConnection::from(['user' => 'badenpowell', 'password' => 'secret', 'base_url' => env('TEST_OWNCLOUD_DOMAIN')]))
|
|
->name('lokaler Server')
|
|
->create();
|
|
|
|
Livewire::test(SettingView::class)
|
|
->assertSee('lokaler Server')
|
|
->assertSee('Verbindung erfolgreich')
|
|
->assertSee('Owncloud');
|
|
// ->assertJsonPath('data.0.name', 'lokaler Server')
|
|
// ->assertJsonPath('data.0.type', OwncloudConnection::class)
|
|
// ->assertJsonPath('data.0.config.user', 'badenpowell')
|
|
// ->assertJsonPath('data.0.config.password', 'secret')
|
|
// ->assertJsonPath('data.0.config.base_url', env('TEST_OWNCLOUD_DOMAIN'))
|
|
// ->assertJsonPath('data.0.id', $connection->id)
|
|
// ->assertJsonPath('data.0.is_active', true)
|
|
// ->assertJsonPath('data.0.type_human', 'Owncloud')
|
|
// ->assertJsonPath('data.0.links.update', route('fileshare.update', ['fileshare' => $connection]))
|
|
// ->assertJsonPath('meta.default.name', '')
|
|
// ->assertJsonPath('meta.links.store', route('fileshare.store'))
|
|
// ->assertJsonPath('meta.types.0.id', NextcloudConnection::class)
|
|
// ->assertJsonPath('meta.types.0.name', 'Nextcloud')
|
|
// ->assertJsonPath('meta.types.0.defaults.base_url', '')
|
|
// ->assertJsonPath('meta.types.1.id', OwncloudConnection::class)
|
|
// ->assertJsonPath('meta.types.1.name', 'Owncloud')
|
|
// ->assertJsonPath('meta.types.1.defaults.base_url', '')
|
|
// ->assertJsonPath('meta.types.0.fields.1', ['label' => 'Benutzer', 'key' => 'user', 'type' => 'text']);
|
|
});
|
|
|
|
it('displays wrong connection', function () {
|
|
$this->withoutExceptionHandling()->login()->loginNami()->withUser('badenpowell', 'secret');
|
|
Fileshare::factory()
|
|
->type(OwncloudConnection::from(['user' => 'badenpowell', 'password' => 'wrong', 'base_url' => env('TEST_OWNCLOUD_DOMAIN')]))
|
|
->name('lokaler Server')
|
|
->create();
|
|
|
|
Livewire::test(SettingView::class)
|
|
->assertSee('lokaler Server')
|
|
->assertSee('Verbindung fehlgeschlagen');
|
|
});
|