Skip to content
This repository has been archived by the owner on Oct 10, 2018. It is now read-only.

Commit

Permalink
Merge pull request #20 from kontenta/fix/adminUser
Browse files Browse the repository at this point in the history
Fix AdminUser
  • Loading branch information
bjuppa authored Oct 5, 2018
2 parents aedea9b + 0d86614 commit 31b968c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion resources/views/widgets/userAccount.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<section data-kontour-widget="userAccount">
<span>{{ $user->getDisplayName() }}</span>
@if($user instanceof \Kontenta\Kontour\Contracts\AdminUser)<span>{{ $user->getDisplayName() }}</span>@endif
<form action="{{ route('kontour.logout') }}" method="post">
{{ csrf_field() }}
<button type="submit">Logout</button>
Expand Down
18 changes: 18 additions & 0 deletions tests/Feature/AuthenticationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,24 @@ public function test_index_route() {
$response->assertSuccessful();
}

public function test_admin_user_account_widget()
{
$routeManager = $this->app->make(\Kontenta\Kontour\Contracts\AdminRouteManager::class);
$response = $this->actingAs($this->user)->get($routeManager->indexUrl());
$response->assertSee('<section data-kontour-widget="userAccount">');
$response->assertSee($this->user->getDisplayName());
$response->assertSee('<button type="submit">Logout</button>');
}

public function test_user_account_widget()
{
$routeManager = $this->app->make(\Kontenta\Kontour\Contracts\AdminRouteManager::class);
$user = new \Illuminate\Foundation\Auth\User();
$response = $this->actingAs($user)->get($routeManager->indexUrl());
$response->assertSee('<section data-kontour-widget="userAccount">');
$response->assertSee('<button type="submit">Logout</button>');
}

public function test_logout()
{
/**
Expand Down
8 changes: 0 additions & 8 deletions tests/Feature/UserlandControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,6 @@ public function test_menu_widget()
$response->assertSee('<a href="' . route('userland.index') . '">Userland Tool</a>');
}

public function test_user_account_widget()
{
$response = $this->actingAs($this->user)->get(route('userland.index'));
$response->assertSee('<section data-kontour-widget="userAccount">');
$response->assertSee($this->user->getDisplayName());
$response->assertSee('<button type="submit">Logout</button>');
}

public function test_recent_visits_widgets()
{
$otherUser = factory(User::class)->create();
Expand Down

0 comments on commit 31b968c

Please sign in to comment.