45 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			1.5 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;
 | |
| 
 | |
| 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');
 | |
| });
 | |
| 
 | |
| 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');
 | |
| });
 |