1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2026-01-03 23:42:28 +03:00

Apply fixes from StyleCI

This commit is contained in:
Dan Brown
2021-06-26 15:23:15 +00:00
committed by StyleCI Bot
parent 3a402f6adc
commit 934a833818
349 changed files with 3655 additions and 2625 deletions

View File

@@ -1,4 +1,6 @@
<?php namespace Tests\User;
<?php
namespace Tests\User;
use BookStack\Actions\ActivityType;
use BookStack\Auth\User;
@@ -7,15 +9,14 @@ use Tests\TestCase;
class UserManagementTest extends TestCase
{
public function test_delete()
{
$editor = $this->getEditor();
$resp = $this->asAdmin()->delete("settings/users/{$editor->id}");
$resp->assertRedirect("/settings/users");
$resp->assertRedirect('/settings/users');
$resp = $this->followRedirects($resp);
$resp->assertSee("User successfully removed");
$resp->assertSee('User successfully removed');
$this->assertActivityExists(ActivityType::USER_DELETE);
$this->assertDatabaseMissing('users', ['id' => $editor->id]);
@@ -25,20 +26,20 @@ class UserManagementTest extends TestCase
{
$editor = $this->getEditor();
$resp = $this->asAdmin()->get("settings/users/{$editor->id}/delete");
$resp->assertSee("Migrate Ownership");
$resp->assertSee("new_owner_id");
$resp->assertSee('Migrate Ownership');
$resp->assertSee('new_owner_id');
}
public function test_delete_with_new_owner_id_changes_ownership()
{
$page = Page::query()->first();
$owner = $page->ownedBy;
$newOwner = User::query()->where('id', '!=' , $owner->id)->first();
$newOwner = User::query()->where('id', '!=', $owner->id)->first();
$this->asAdmin()->delete("settings/users/{$owner->id}", ['new_owner_id' => $newOwner->id]);
$this->assertDatabaseHas('pages', [
'id' => $page->id,
'id' => $page->id,
'owned_by' => $newOwner->id,
]);
}
}
}