mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 06:17:28 -08:00
Shuffled tests around again
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
67ab2536bc
commit
134183ef16
|
@ -11,7 +11,7 @@ use Tests\TestCase;
|
|||
class ViewUserTest extends TestCase
|
||||
{
|
||||
|
||||
public function testCanReturnUser()
|
||||
public function testCanReturnUser()
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Feature\Users;
|
||||
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use App\Models\Company;
|
||||
use App\Models\User;
|
||||
use Tests\TestCase;
|
||||
use App\Notifications\CurrentInventory;
|
||||
|
||||
class DeleteUserTest extends TestCase
|
||||
{
|
||||
|
||||
public function testPermissionsToDeleteUser()
|
||||
{
|
||||
|
||||
$this->settings->enableMultipleFullCompanySupport();
|
||||
|
||||
[$companyA, $companyB] = Company::factory()->count(2)->create();
|
||||
|
||||
$superuser = User::factory()->superuser()->create();
|
||||
$userFromA = User::factory()->for($companyA)->create();
|
||||
$userFromB = User::factory()->for($companyB)->create();
|
||||
|
||||
$this->followingRedirects()->actingAs(User::factory()->deleteUsers()->for($companyA)->create())
|
||||
->delete(route('users.destroy', ['user' => $userFromB->id]))
|
||||
->assertStatus(403);
|
||||
|
||||
$this->actingAs(User::factory()->deleteUsers()->for($companyA)->create())
|
||||
->delete(route('users.destroy', ['user' => $userFromA->id]))
|
||||
->assertStatus(302)
|
||||
->assertRedirect(route('users.index'));
|
||||
|
||||
$this->actingAs($superuser)
|
||||
->post(route('users.email', ['userId' => $userFromA->id]))
|
||||
->assertStatus(302);
|
||||
|
||||
$this->actingAs($superuser)
|
||||
->post(route('users.email', ['userId' => $userFromB->id]))
|
||||
->assertStatus(302);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -13,7 +13,37 @@ use App\Models\Asset;
|
|||
class DeleteUserTest extends TestCase
|
||||
{
|
||||
|
||||
public function testPermissionsToDeleteUser()
|
||||
{
|
||||
|
||||
$this->settings->enableMultipleFullCompanySupport();
|
||||
|
||||
[$companyA, $companyB] = Company::factory()->count(2)->create();
|
||||
|
||||
$superuser = User::factory()->superuser()->create();
|
||||
$userFromA = User::factory()->for($companyA)->create();
|
||||
$userFromB = User::factory()->for($companyB)->create();
|
||||
|
||||
$this->followingRedirects()->actingAs(User::factory()->deleteUsers()->for($companyA)->create())
|
||||
->delete(route('users.destroy', ['user' => $userFromB->id]))
|
||||
->assertStatus(403);
|
||||
|
||||
$this->actingAs(User::factory()->deleteUsers()->for($companyA)->create())
|
||||
->delete(route('users.destroy', ['user' => $userFromA->id]))
|
||||
->assertStatus(302)
|
||||
->assertRedirect(route('users.index'));
|
||||
|
||||
$this->actingAs($superuser)
|
||||
->post(route('users.email', ['userId' => $userFromA->id]))
|
||||
->assertStatus(302);
|
||||
|
||||
$this->actingAs($superuser)
|
||||
->post(route('users.email', ['userId' => $userFromB->id]))
|
||||
->assertStatus(302);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function testDisallowUserDeletionIfStillManagingPeople()
|
||||
{
|
||||
$manager = User::factory()->create();
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Feature\Users;
|
||||
namespace Feature\Users\Ui;
|
||||
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use App\Models\Company;
|
||||
use App\Models\User;
|
||||
use Tests\TestCase;
|
||||
use App\Notifications\CurrentInventory;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ViewUserTest extends TestCase
|
||||
{
|
Loading…
Reference in a new issue