mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
Updated failing tests, Applied StyleCI changes
This commit is contained in:
parent
bb9cd9d610
commit
67b6c07548
@ -48,7 +48,6 @@ class CreateAdmin extends Command
|
|||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
|
||||||
$details = $this->options();
|
$details = $this->options();
|
||||||
|
|
||||||
if (empty($details['email'])) {
|
if (empty($details['email'])) {
|
||||||
@ -71,6 +70,7 @@ class CreateAdmin extends Command
|
|||||||
foreach ($validator->errors()->all() as $error) {
|
foreach ($validator->errors()->all() as $error) {
|
||||||
$this->error($error);
|
$this->error($error);
|
||||||
}
|
}
|
||||||
|
|
||||||
return SymfonyCommand::FAILURE;
|
return SymfonyCommand::FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Database\Factories\Auth;
|
namespace Database\Factories\Auth;
|
||||||
|
|
||||||
|
use BookStack\Auth\User;
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
@ -12,7 +13,7 @@ class UserFactory extends Factory
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $model = \BookStack\Auth\User::class;
|
protected $model = User::class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the model's default state.
|
* Define the model's default state.
|
||||||
@ -26,7 +27,7 @@ class UserFactory extends Factory
|
|||||||
return [
|
return [
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'email' => $this->faker->email,
|
'email' => $this->faker->email,
|
||||||
'slug' => \Illuminate\Support\Str::slug($name . '-' . \Illuminate\Support\Str::random(5)),
|
'slug' => Str::slug($name . '-' . Str::random(5)),
|
||||||
'password' => Str::random(10),
|
'password' => Str::random(10),
|
||||||
'remember_token' => Str::random(10),
|
'remember_token' => Str::random(10),
|
||||||
'email_confirmed' => 1,
|
'email_confirmed' => 1,
|
||||||
|
@ -34,7 +34,7 @@ class TestEmailTest extends TestCase
|
|||||||
$this->app[Dispatcher::class] = $mockDispatcher;
|
$this->app[Dispatcher::class] = $mockDispatcher;
|
||||||
|
|
||||||
$exception = new \Exception('A random error occurred when testing an email');
|
$exception = new \Exception('A random error occurred when testing an email');
|
||||||
$mockDispatcher->shouldReceive('send')->andThrow($exception);
|
$mockDispatcher->shouldReceive('sendNow')->andThrow($exception);
|
||||||
|
|
||||||
$admin = $this->getAdmin();
|
$admin = $this->getAdmin();
|
||||||
$sendReq = $this->actingAs($admin)->post('/settings/maintenance/send-test-email');
|
$sendReq = $this->actingAs($admin)->post('/settings/maintenance/send-test-email');
|
||||||
|
@ -11,16 +11,16 @@ class AvatarTest extends TestCase
|
|||||||
{
|
{
|
||||||
use UsesImages;
|
use UsesImages;
|
||||||
|
|
||||||
protected function createUserRequest($user)
|
protected function createUserRequest($user): User
|
||||||
{
|
{
|
||||||
$this->asAdmin()->post('/settings/users/create', [
|
$this->asAdmin()->post('/settings/users/create', [
|
||||||
'name' => $user->name,
|
'name' => $user->name,
|
||||||
'email' => $user->email,
|
'email' => $user->email,
|
||||||
'password' => 'testing',
|
'password' => 'testing101',
|
||||||
'password-confirm' => 'testing',
|
'password-confirm' => 'testing101',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return User::where('email', '=', $user->email)->first();
|
return User::query()->where('email', '=', $user->email)->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function assertImageFetchFrom(string $url)
|
protected function assertImageFetchFrom(string $url)
|
||||||
|
Loading…
Reference in New Issue
Block a user