mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-11-22 10:10:12 +08:00
Updated to Laravel 5.8
This commit is contained in:
parent
58f5508b05
commit
140298bd96
|
@ -23,5 +23,7 @@ before_script:
|
|||
- php artisan migrate --force -n --database=mysql_testing
|
||||
- php artisan db:seed --force -n --class=DummyContentSeeder --database=mysql_testing
|
||||
|
||||
script: vendor/bin/phpunit --configuration phpunit.xml
|
||||
|
||||
after_failure:
|
||||
- cat storage/logs/laravel.log
|
||||
|
|
|
@ -5,6 +5,7 @@ use BookStack\Auth\UserRepo;
|
|||
use BookStack\Exceptions\SocialDriverNotConfigured;
|
||||
use BookStack\Exceptions\SocialSignInAccountNotUsed;
|
||||
use BookStack\Exceptions\UserRegistrationException;
|
||||
use Illuminate\Support\Str;
|
||||
use Laravel\Socialite\Contracts\Factory as Socialite;
|
||||
use Laravel\Socialite\Contracts\User as SocialUser;
|
||||
|
||||
|
@ -104,6 +105,7 @@ class SocialAuthService
|
|||
$socialAccount = $this->socialAccount->where('driver_id', '=', $socialId)->first();
|
||||
$isLoggedIn = auth()->check();
|
||||
$currentUser = user();
|
||||
$titleCaseDriver = Str::title($socialDriver);
|
||||
|
||||
// When a user is not logged in and a matching SocialAccount exists,
|
||||
// Simply log the user into the application.
|
||||
|
@ -117,26 +119,26 @@ class SocialAuthService
|
|||
if ($isLoggedIn && $socialAccount === null) {
|
||||
$this->fillSocialAccount($socialDriver, $socialUser);
|
||||
$currentUser->socialAccounts()->save($this->socialAccount);
|
||||
session()->flash('success', trans('settings.users_social_connected', ['socialAccount' => title_case($socialDriver)]));
|
||||
session()->flash('success', trans('settings.users_social_connected', ['socialAccount' => $titleCaseDriver]));
|
||||
return redirect($currentUser->getEditUrl());
|
||||
}
|
||||
|
||||
// When a user is logged in and the social account exists and is already linked to the current user.
|
||||
if ($isLoggedIn && $socialAccount !== null && $socialAccount->user->id === $currentUser->id) {
|
||||
session()->flash('error', trans('errors.social_account_existing', ['socialAccount' => title_case($socialDriver)]));
|
||||
session()->flash('error', trans('errors.social_account_existing', ['socialAccount' => $titleCaseDriver]));
|
||||
return redirect($currentUser->getEditUrl());
|
||||
}
|
||||
|
||||
// When a user is logged in, A social account exists but the users do not match.
|
||||
if ($isLoggedIn && $socialAccount !== null && $socialAccount->user->id != $currentUser->id) {
|
||||
session()->flash('error', trans('errors.social_account_already_used_existing', ['socialAccount' => title_case($socialDriver)]));
|
||||
session()->flash('error', trans('errors.social_account_already_used_existing', ['socialAccount' => $titleCaseDriver]));
|
||||
return redirect($currentUser->getEditUrl());
|
||||
}
|
||||
|
||||
// Otherwise let the user know this social account is not used by anyone.
|
||||
$message = trans('errors.social_account_not_used', ['socialAccount' => title_case($socialDriver)]);
|
||||
$message = trans('errors.social_account_not_used', ['socialAccount' => $titleCaseDriver]);
|
||||
if (setting('registration-enabled')) {
|
||||
$message .= trans('errors.social_account_register_instructions', ['socialAccount' => title_case($socialDriver)]);
|
||||
$message .= trans('errors.social_account_register_instructions', ['socialAccount' => $titleCaseDriver]);
|
||||
}
|
||||
|
||||
throw new SocialSignInAccountNotUsed($message, '/login');
|
||||
|
@ -157,7 +159,7 @@ class SocialAuthService
|
|||
abort(404, trans('errors.social_driver_not_found'));
|
||||
}
|
||||
if (!$this->checkDriverConfigured($driver)) {
|
||||
throw new SocialDriverNotConfigured(trans('errors.social_driver_not_configured', ['socialAccount' => title_case($socialDriver)]));
|
||||
throw new SocialDriverNotConfigured(trans('errors.social_driver_not_configured', ['socialAccount' => Str::title($socialDriver)]));
|
||||
}
|
||||
|
||||
return $driver;
|
||||
|
@ -244,7 +246,7 @@ class SocialAuthService
|
|||
public function detachSocialAccount($socialDriver)
|
||||
{
|
||||
user()->socialAccounts()->where('driver', '=', $socialDriver)->delete();
|
||||
session()->flash('success', trans('settings.users_social_disconnected', ['socialAccount' => title_case($socialDriver)]));
|
||||
session()->flash('success', trans('settings.users_social_disconnected', ['socialAccount' => Str::title($socialDriver)]));
|
||||
return redirect(user()->getEditUrl());
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ use BookStack\Exceptions\UserTokenExpiredException;
|
|||
use BookStack\Exceptions\UserTokenNotFoundException;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Connection as Database;
|
||||
use Illuminate\Support\Str;
|
||||
use stdClass;
|
||||
|
||||
class UserTokenService
|
||||
|
@ -73,9 +74,9 @@ class UserTokenService
|
|||
*/
|
||||
protected function generateToken() : string
|
||||
{
|
||||
$token = str_random(24);
|
||||
$token = Str::random(24);
|
||||
while ($this->tokenExists($token)) {
|
||||
$token = str_random(25);
|
||||
$token = Str::random(25);
|
||||
}
|
||||
return $token;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
use BookStack\Auth\Permissions;
|
||||
use BookStack\Auth\Role;
|
||||
use BookStack\Exceptions\PermissionsException;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class PermissionsRepo
|
||||
{
|
||||
|
@ -66,7 +67,7 @@ class PermissionsRepo
|
|||
$role->name = str_replace(' ', '-', strtolower($roleData['display_name']));
|
||||
// Prevent duplicate names
|
||||
while ($this->role->where('name', '=', $role->name)->count() > 0) {
|
||||
$role->name .= strtolower(str_random(2));
|
||||
$role->name .= strtolower(Str::random(2));
|
||||
}
|
||||
$role->save();
|
||||
|
||||
|
|
|
@ -136,6 +136,7 @@ return [
|
|||
|
||||
// Laravel
|
||||
'App' => Illuminate\Support\Facades\App::class,
|
||||
'Arr' => Illuminate\Support\Arr::class,
|
||||
'Artisan' => Illuminate\Support\Facades\Artisan::class,
|
||||
'Auth' => Illuminate\Support\Facades\Auth::class,
|
||||
'Blade' => Illuminate\Support\Facades\Blade::class,
|
||||
|
@ -165,6 +166,7 @@ return [
|
|||
'Schema' => Illuminate\Support\Facades\Schema::class,
|
||||
'Session' => Illuminate\Support\Facades\Session::class,
|
||||
'Storage' => Illuminate\Support\Facades\Storage::class,
|
||||
'Str' => Illuminate\Support\Str::class,
|
||||
'URL' => Illuminate\Support\Facades\URL::class,
|
||||
'Validator' => Illuminate\Support\Facades\Validator::class,
|
||||
'View' => Illuminate\Support\Facades\View::class,
|
||||
|
|
|
@ -36,6 +36,7 @@ return [
|
|||
'api' => [
|
||||
'driver' => 'token',
|
||||
'provider' => 'users',
|
||||
'hash' => false,
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
@ -24,9 +24,13 @@ return [
|
|||
|
||||
'pusher' => [
|
||||
'driver' => 'pusher',
|
||||
'key' => env('PUSHER_KEY'),
|
||||
'secret' => env('PUSHER_SECRET'),
|
||||
'key' => env('PUSHER_APP_KEY'),
|
||||
'secret' => env('PUSHER_APP_SECRET'),
|
||||
'app_id' => env('PUSHER_APP_ID'),
|
||||
'options' => [
|
||||
'cluster' => env('PUSHER_APP_CLUSTER'),
|
||||
'useTLS' => true,
|
||||
],
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
|
@ -38,6 +42,11 @@ return [
|
|||
'driver' => 'log',
|
||||
],
|
||||
|
||||
'null' => [
|
||||
'driver' => 'null',
|
||||
],
|
||||
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
|
|
|
@ -59,14 +59,9 @@ return [
|
|||
// Many of those shown here are unsupported by BookStack.
|
||||
'connections' => [
|
||||
|
||||
'sqlite' => [
|
||||
'driver' => 'sqlite',
|
||||
'database' => storage_path('database.sqlite'),
|
||||
'prefix' => '',
|
||||
],
|
||||
|
||||
'mysql' => [
|
||||
'driver' => 'mysql',
|
||||
'url' => env('DATABASE_URL'),
|
||||
'host' => $mysql_host,
|
||||
'database' => env('DB_DATABASE', 'forge'),
|
||||
'username' => env('DB_USERNAME', 'forge'),
|
||||
|
@ -79,10 +74,14 @@ return [
|
|||
'prefix_indexes' => true,
|
||||
'strict' => false,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||
]) : [],
|
||||
],
|
||||
|
||||
'mysql_testing' => [
|
||||
'driver' => 'mysql',
|
||||
'url' => env('TEST_DATABASE_URL'),
|
||||
'host' => '127.0.0.1',
|
||||
'database' => 'bookstack-test',
|
||||
'username' => env('MYSQL_USER', 'bookstack-test'),
|
||||
|
@ -94,27 +93,6 @@ return [
|
|||
'strict' => false,
|
||||
],
|
||||
|
||||
'pgsql' => [
|
||||
'driver' => 'pgsql',
|
||||
'host' => env('DB_HOST', 'localhost'),
|
||||
'database' => env('DB_DATABASE', 'forge'),
|
||||
'username' => env('DB_USERNAME', 'forge'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => 'utf8',
|
||||
'prefix' => '',
|
||||
'schema' => 'public',
|
||||
],
|
||||
|
||||
'sqlsrv' => [
|
||||
'driver' => 'sqlsrv',
|
||||
'host' => env('DB_HOST', 'localhost'),
|
||||
'database' => env('DB_DATABASE', 'forge'),
|
||||
'username' => env('DB_USERNAME', 'forge'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => 'utf8',
|
||||
'prefix' => '',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
// Migration Repository Table
|
||||
|
|
|
@ -17,6 +17,7 @@ return [
|
|||
// Queue connection configuration
|
||||
'connections' => [
|
||||
|
||||
|
||||
'sync' => [
|
||||
'driver' => 'sync',
|
||||
],
|
||||
|
@ -25,38 +26,15 @@ return [
|
|||
'driver' => 'database',
|
||||
'table' => 'jobs',
|
||||
'queue' => 'default',
|
||||
'expire' => 60,
|
||||
],
|
||||
|
||||
'beanstalkd' => [
|
||||
'driver' => 'beanstalkd',
|
||||
'host' => 'localhost',
|
||||
'queue' => 'default',
|
||||
'ttr' => 60,
|
||||
],
|
||||
|
||||
'sqs' => [
|
||||
'driver' => 'sqs',
|
||||
'key' => 'your-public-key',
|
||||
'secret' => 'your-secret-key',
|
||||
'queue' => 'your-queue-url',
|
||||
'region' => 'us-east-1',
|
||||
],
|
||||
|
||||
'iron' => [
|
||||
'driver' => 'iron',
|
||||
'host' => 'mq-aws-us-east-1.iron.io',
|
||||
'token' => 'your-token',
|
||||
'project' => 'your-project-id',
|
||||
'queue' => 'your-queue-name',
|
||||
'encrypt' => true,
|
||||
'retry_after' => 90,
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => 'default',
|
||||
'queue' => 'default',
|
||||
'expire' => 60,
|
||||
'queue' => env('REDIS_QUEUE', 'default'),
|
||||
'retry_after' => 90,
|
||||
'block_for' => null,
|
||||
],
|
||||
|
||||
],
|
||||
|
|
|
@ -22,28 +22,6 @@ return [
|
|||
// Callback URL for social authentication methods
|
||||
'callback_url' => env('APP_URL', false),
|
||||
|
||||
'mailgun' => [
|
||||
'domain' => '',
|
||||
'secret' => '',
|
||||
'endpoint' => '',
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'key' => '',
|
||||
'secret' => '',
|
||||
'region' => 'us-east-1',
|
||||
],
|
||||
|
||||
'stripe' => [
|
||||
'model' => \BookStack\Auth\User::class,
|
||||
'key' => '',
|
||||
'secret' => '',
|
||||
'webhook' => [
|
||||
'secret' => '',
|
||||
'tolerance' => 300,
|
||||
],
|
||||
],
|
||||
|
||||
'github' => [
|
||||
'client_id' => env('GITHUB_APP_ID', false),
|
||||
'client_secret' => env('GITHUB_APP_SECRET', false),
|
||||
|
|
|
@ -23,8 +23,9 @@ class BreadcrumbsViewComposer
|
|||
public function compose(View $view)
|
||||
{
|
||||
$crumbs = $view->getData()['crumbs'];
|
||||
if (array_first($crumbs) instanceof Book) {
|
||||
$shelf = $this->entityContextManager->getContextualShelfForBook(array_first($crumbs));
|
||||
$firstCrumb = $crumbs[0] ?? null;
|
||||
if ($firstCrumb instanceof Book) {
|
||||
$shelf = $this->entityContextManager->getContextualShelfForBook($firstCrumb);
|
||||
if ($shelf) {
|
||||
array_unshift($crumbs, $shelf);
|
||||
$view->with('crumbs', $crumbs);
|
||||
|
|
|
@ -6,6 +6,7 @@ use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
|||
use Illuminate\Database\Query\Builder;
|
||||
use Illuminate\Database\Query\JoinClause;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class SearchService
|
||||
{
|
||||
|
@ -210,7 +211,7 @@ class SearchService
|
|||
|
||||
// Handle filters
|
||||
foreach ($terms['filters'] as $filterTerm => $filterValue) {
|
||||
$functionName = camel_case('filter_' . $filterTerm);
|
||||
$functionName = Str::camel('filter_' . $filterTerm);
|
||||
if (method_exists($this, $functionName)) {
|
||||
$this->$functionName($entitySelect, $entity, $filterValue);
|
||||
}
|
||||
|
@ -514,7 +515,7 @@ class SearchService
|
|||
|
||||
protected function filterSortBy(EloquentBuilder $query, Entity $model, $input)
|
||||
{
|
||||
$functionName = camel_case('sort_by_' . $input);
|
||||
$functionName = Str::camel('sort_by_' . $input);
|
||||
if (method_exists($this, $functionName)) {
|
||||
$this->$functionName($query, $model);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ use Illuminate\Http\Request;
|
|||
use Illuminate\Http\Response;
|
||||
use Illuminate\Routing\Redirector;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
use Laravel\Socialite\Contracts\User as SocialUser;
|
||||
use Validator;
|
||||
|
||||
|
@ -78,7 +79,7 @@ class RegisterController extends Controller
|
|||
return Validator::make($data, [
|
||||
'name' => 'required|min:2|max:255',
|
||||
'email' => 'required|email|max:255|unique:users',
|
||||
'password' => 'required|min:6',
|
||||
'password' => 'required|min:8',
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -262,7 +263,7 @@ class RegisterController extends Controller
|
|||
$userData = [
|
||||
'name' => $socialUser->getName(),
|
||||
'email' => $socialUser->getEmail(),
|
||||
'password' => str_random(30)
|
||||
'password' => Str::random(30)
|
||||
];
|
||||
return $this->registerUser($userData, $socialAccount, $emailVerified);
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ class UserInviteController extends Controller
|
|||
public function setPassword(string $token, Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'password' => 'required|min:6'
|
||||
'password' => 'required|min:8'
|
||||
]);
|
||||
|
||||
try {
|
||||
|
|
|
@ -8,6 +8,7 @@ use BookStack\Exceptions\UserUpdateException;
|
|||
use BookStack\Uploads\ImageRepo;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
|
@ -92,7 +93,7 @@ class UserController extends Controller
|
|||
$user = $this->user->fill($request->all());
|
||||
|
||||
if ($authMethod === 'standard') {
|
||||
$user->password = bcrypt($request->get('password', str_random(32)));
|
||||
$user->password = bcrypt($request->get('password', Str::random(32)));
|
||||
} elseif ($authMethod === 'ldap') {
|
||||
$user->external_auth_id = $request->get('external_auth_id');
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ class Attachment extends Ownable
|
|||
*/
|
||||
public function getFileName()
|
||||
{
|
||||
if (str_contains($this->name, '.')) {
|
||||
if (strpos($this->name, '.') !== false) {
|
||||
return $this->name;
|
||||
}
|
||||
return $this->name . '.' . $this->extension;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use BookStack\Exceptions\FileUploadException;
|
||||
use Exception;
|
||||
use Illuminate\Support\Str;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
|
||||
class AttachmentService extends UploadService
|
||||
|
@ -185,9 +186,9 @@ class AttachmentService extends UploadService
|
|||
$storage = $this->getStorage();
|
||||
$basePath = 'uploads/files/' . Date('Y-m-M') . '/';
|
||||
|
||||
$uploadFileName = str_random(16) . '.' . $uploadedFile->getClientOriginalExtension();
|
||||
$uploadFileName = Str::random(16) . '.' . $uploadedFile->getClientOriginalExtension();
|
||||
while ($storage->exists($basePath . $uploadFileName)) {
|
||||
$uploadFileName = str_random(3) . $uploadFileName;
|
||||
$uploadFileName = Str::random(3) . $uploadFileName;
|
||||
}
|
||||
|
||||
$attachmentPath = $basePath . $uploadFileName;
|
||||
|
|
|
@ -7,6 +7,7 @@ use DB;
|
|||
use Exception;
|
||||
use Illuminate\Contracts\Cache\Repository as Cache;
|
||||
use Illuminate\Contracts\Filesystem\Factory as FileSystem;
|
||||
use Illuminate\Support\Str;
|
||||
use Intervention\Image\Exception\NotSupportedException;
|
||||
use Intervention\Image\ImageManager;
|
||||
use phpDocumentor\Reflection\Types\Integer;
|
||||
|
@ -140,12 +141,12 @@ class ImageService extends UploadService
|
|||
$imagePath = '/uploads/images/' . $type . '/' . Date('Y-m') . '/';
|
||||
|
||||
while ($storage->exists($imagePath . $imageName)) {
|
||||
$imageName = str_random(3) . $imageName;
|
||||
$imageName = Str::random(3) . $imageName;
|
||||
}
|
||||
|
||||
$fullPath = $imagePath . $imageName;
|
||||
if ($secureUploads) {
|
||||
$fullPath = $imagePath . str_random(16) . '-' . $imageName;
|
||||
$fullPath = $imagePath . Str::random(16) . '-' . $imageName;
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -220,7 +221,7 @@ class ImageService extends UploadService
|
|||
|
||||
$storage->put($thumbFilePath, $thumbData);
|
||||
$storage->setVisibility($thumbFilePath, 'public');
|
||||
$this->cache->put('images-' . $image->id . '-' . $thumbFilePath, $thumbFilePath, 60 * 72);
|
||||
$this->cache->put('images-' . $image->id . '-' . $thumbFilePath, $thumbFilePath, 60 * 60 * 72);
|
||||
|
||||
return $this->getPublicUrl($thumbFilePath);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
"ext-mbstring": "*",
|
||||
"ext-gd": "*",
|
||||
"ext-curl": "*",
|
||||
"laravel/framework": "5.7.*",
|
||||
"laravel/framework": "5.8.*",
|
||||
"fideloper/proxy": "^4.0",
|
||||
"intervention/image": "^2.5",
|
||||
"laravel/socialite": "^4.2",
|
||||
|
@ -35,8 +35,8 @@
|
|||
"filp/whoops": "^2.0",
|
||||
"fzaninotto/faker": "^1.4",
|
||||
"mockery/mockery": "^1.0",
|
||||
"phpunit/phpunit": "^7.0",
|
||||
"nunomaduro/collision": "^2.0",
|
||||
"phpunit/phpunit": "^7.5",
|
||||
"nunomaduro/collision": "^3.0",
|
||||
"laravel/browser-kit-testing": "^4.2.1",
|
||||
"barryvdh/laravel-ide-helper": "^2.6.4",
|
||||
"barryvdh/laravel-debugbar": "^3.2.8",
|
||||
|
|
717
composer.lock
generated
717
composer.lock
generated
File diff suppressed because it is too large
Load Diff
56
phpunit.xml
56
phpunit.xml
|
@ -19,33 +19,33 @@
|
|||
</whitelist>
|
||||
</filter>
|
||||
<php>
|
||||
<env name="APP_ENV" value="testing"/>
|
||||
<env name="APP_DEBUG" value="false"/>
|
||||
<env name="APP_LANG" value="en"/>
|
||||
<env name="APP_AUTO_LANG_PUBLIC" value="true"/>
|
||||
<env name="CACHE_DRIVER" value="array"/>
|
||||
<env name="SESSION_DRIVER" value="array"/>
|
||||
<env name="QUEUE_CONNECTION" value="sync"/>
|
||||
<env name="DB_CONNECTION" value="mysql_testing"/>
|
||||
<env name="BCRYPT_ROUNDS" value="4"/>
|
||||
<env name="MAIL_DRIVER" value="log"/>
|
||||
<env name="AUTH_METHOD" value="standard"/>
|
||||
<env name="DISABLE_EXTERNAL_SERVICES" value="true"/>
|
||||
<env name="AVATAR_URL" value=""/>
|
||||
<env name="LDAP_VERSION" value="3"/>
|
||||
<env name="STORAGE_TYPE" value="local"/>
|
||||
<env name="STORAGE_ATTACHMENT_TYPE" value="local"/>
|
||||
<env name="STORAGE_IMAGE_TYPE" value="local"/>
|
||||
<env name="GITHUB_APP_ID" value="aaaaaaaaaaaaaa"/>
|
||||
<env name="GITHUB_APP_SECRET" value="aaaaaaaaaaaaaa"/>
|
||||
<env name="GITHUB_AUTO_REGISTER" value=""/>
|
||||
<env name="GITHUB_AUTO_CONFIRM_EMAIL" value=""/>
|
||||
<env name="GOOGLE_APP_ID" value="aaaaaaaaaaaaaa"/>
|
||||
<env name="GOOGLE_APP_SECRET" value="aaaaaaaaaaaaaa"/>
|
||||
<env name="GOOGLE_AUTO_REGISTER" value=""/>
|
||||
<env name="GOOGLE_AUTO_CONFIRM_EMAIL" value=""/>
|
||||
<env name="GOOGLE_SELECT_ACCOUNT" value=""/>
|
||||
<env name="APP_URL" value="http://bookstack.dev"/>
|
||||
<env name="DEBUGBAR_ENABLED" value="false"/>
|
||||
<server name="APP_ENV" value="testing"/>
|
||||
<server name="APP_DEBUG" value="false"/>
|
||||
<server name="APP_LANG" value="en"/>
|
||||
<server name="APP_AUTO_LANG_PUBLIC" value="true"/>
|
||||
<server name="CACHE_DRIVER" value="array"/>
|
||||
<server name="SESSION_DRIVER" value="array"/>
|
||||
<server name="QUEUE_CONNECTION" value="sync"/>
|
||||
<server name="DB_CONNECTION" value="mysql_testing"/>
|
||||
<server name="BCRYPT_ROUNDS" value="4"/>
|
||||
<server name="MAIL_DRIVER" value="log"/>
|
||||
<server name="AUTH_METHOD" value="standard"/>
|
||||
<server name="DISABLE_EXTERNAL_SERVICES" value="true"/>
|
||||
<server name="AVATAR_URL" value=""/>
|
||||
<server name="LDAP_VERSION" value="3"/>
|
||||
<server name="STORAGE_TYPE" value="local"/>
|
||||
<server name="STORAGE_ATTACHMENT_TYPE" value="local"/>
|
||||
<server name="STORAGE_IMAGE_TYPE" value="local"/>
|
||||
<server name="GITHUB_APP_ID" value="aaaaaaaaaaaaaa"/>
|
||||
<server name="GITHUB_APP_SECRET" value="aaaaaaaaaaaaaa"/>
|
||||
<server name="GITHUB_AUTO_REGISTER" value=""/>
|
||||
<server name="GITHUB_AUTO_CONFIRM_EMAIL" value=""/>
|
||||
<server name="GOOGLE_APP_ID" value="aaaaaaaaaaaaaa"/>
|
||||
<server name="GOOGLE_APP_SECRET" value="aaaaaaaaaaaaaa"/>
|
||||
<server name="GOOGLE_AUTO_REGISTER" value=""/>
|
||||
<server name="GOOGLE_AUTO_CONFIRM_EMAIL" value=""/>
|
||||
<server name="GOOGLE_SELECT_ACCOUNT" value=""/>
|
||||
<server name="APP_URL" value="http://bookstack.dev"/>
|
||||
<server name="DEBUGBAR_ENABLED" value="false"/>
|
||||
</php>
|
||||
</phpunit>
|
||||
|
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 6.5 KiB |
|
@ -1 +0,0 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 1024 1024"><defs><linearGradient id="a" x1="50.31%" x2="50%" y1="74.74%" y2="0%"><stop offset="0%" stop-color="#FFE98A"/><stop offset="67.7%" stop-color="#B63E59"/><stop offset="100%" stop-color="#68126F"/></linearGradient><circle id="c" cx="603" cy="682" r="93"/><filter id="b" width="203.2%" height="203.2%" x="-51.6%" y="-51.6%" filterUnits="objectBoundingBox"><feOffset in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur in="shadowOffsetOuter1" result="shadowBlurOuter1" stdDeviation="32"/><feColorMatrix in="shadowBlurOuter1" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0"/></filter><linearGradient id="d" x1="49.48%" x2="49.87%" y1="11.66%" y2="77.75%"><stop offset="0%" stop-color="#F7EAB9"/><stop offset="100%" stop-color="#E5765E"/></linearGradient><linearGradient id="e" x1="91.59%" x2="66.97%" y1="5.89%" y2="100%"><stop offset="0%" stop-color="#A22A50"/><stop offset="100%" stop-color="#EE7566"/></linearGradient><linearGradient id="f" x1="49.48%" x2="49.61%" y1="11.66%" y2="98.34%"><stop offset="0%" stop-color="#F7EAB9"/><stop offset="100%" stop-color="#E5765E"/></linearGradient><linearGradient id="g" x1="78.5%" x2="36.4%" y1="106.76%" y2="26.41%"><stop offset="0%" stop-color="#A22A50"/><stop offset="100%" stop-color="#EE7566"/></linearGradient></defs><g fill="none" fill-rule="evenodd"><rect width="1024" height="1024" fill="url(#a)"/><use fill="black" filter="url(#b)" xlink:href="#c"/><use fill="#FFF6CB" xlink:href="#c"/><g fill="#FFFFFF" opacity=".3" transform="translate(14 23)"><circle cx="203" cy="255" r="3" fill-opacity=".4"/><circle cx="82" cy="234" r="2"/><circle cx="22" cy="264" r="2" opacity=".4"/><circle cx="113" cy="65" r="3"/><circle cx="202" cy="2" r="2"/><circle cx="2" cy="114" r="2"/><circle cx="152" cy="144" r="2"/><circle cx="362" cy="224" r="2"/><circle cx="453" cy="65" r="3" opacity=".4"/><circle cx="513" cy="255" r="3"/><circle cx="593" cy="115" r="3"/><circle cx="803" cy="5" r="3" opacity=".4"/><circle cx="502" cy="134" r="2"/><circle cx="832" cy="204" r="2"/><circle cx="752" cy="114" r="2"/><circle cx="933" cy="255" r="3" opacity=".4"/><circle cx="703" cy="225" r="3"/><circle cx="903" cy="55" r="3"/><circle cx="982" cy="144" r="2"/><circle cx="632" cy="14" r="2"/></g><g transform="translate(0 550)"><path fill="#8E2C15" d="M259 5.47c0 5.33 3.33 9.5 10 12.5s9.67 9.16 9 18.5h1c.67-6.31 1-11.8 1-16.47 8.67 0 13.33-1.33 14-4 .67 4.98 1.67 8.3 3 9.97 1.33 1.66 2 5.16 2 10.5h1c0-5.65.33-9.64 1-11.97 1-3.5 4-10.03-1-14.53S295 7 290 3c-5-4-10-3-13 2s-5 7-9 7-5-3.53-5-5.53c0-2 2-5-1.5-5s-7.5 0-7.5 2c0 1.33 1.67 2 5 2z"/><path fill="url(#d)" d="M1024 390H0V105.08C77.3 71.4 155.26 35 297.4 35c250 0 250.76 125.25 500 125 84.03-.08 160.02-18.2 226.6-40.93V390z"/><path fill="url(#d)" d="M1024 442H0V271.82c137.51-15.4 203.1-50.49 356.67-60.1C555.24 199.3 606.71 86.59 856.74 86.59c72.78 0 124.44 10.62 167.26 25.68V442z"/><path fill="url(#e)" d="M1024 112.21V412H856.91c99.31-86.5 112.63-140.75 39.97-162.78C710.24 192.64 795.12 86.58 856.9 86.58c72.7 0 124.3 10.6 167.09 25.63z"/><path fill="url(#e)" d="M1024 285.32V412H857c99.31-86.6 112.63-140.94 39.97-163L1024 285.32z"/><path fill="url(#f)" d="M0 474V223.93C67.12 190.69 129.55 155 263 155c250 0 331.46 162.6 530 175 107.42 6.71 163-26.77 231-58.92V474H0z"/><path fill="url(#e)" d="M353.02 474H0V223.93C67.12 190.69 129.55 155 263 155c71.14 0 151.5 12.76 151.5 70.5 0 54.5-45.5 79.72-112.5 109-82.26 35.95-54.57 111.68 51.02 139.5z"/><path fill="url(#g)" d="M353.02 474H0v-14.8l302-124.7c-82.26 35.95-54.57 111.68 51.02 139.5z"/></g><g fill="#FFFFFF" opacity=".2" transform="translate(288 523)"><circle cx="250" cy="110" r="110"/><circle cx="420" cy="78" r="60"/><circle cx="70" cy="220" r="70"/></g><g fill="#FFFFFF" fill-rule="nonzero" opacity=".08" transform="translate(135 316)"><path d="M10 80.22a14.2 14.2 0 0 1 20 0 14.2 14.2 0 0 0 20 0l20-19.86a42.58 42.58 0 0 1 60 0l15 14.9a21.3 21.3 0 0 0 30 0 21.3 21.3 0 0 1 30 0l.9.9A47.69 47.69 0 0 1 220 110H0v-5.76c0-9.02 3.6-17.67 10-24.02zm559.1-66.11l5.9-5.86c11.07-11 28.93-11 40 0l10 9.94a14.19 14.19 0 0 0 20 0 14.19 14.19 0 0 1 20 0 16.36 16.36 0 0 0 21.3 1.5l8.7-6.47a33.47 33.47 0 0 1 40 0l4.06 3.03A39.6 39.6 0 0 1 755 48H555a47.77 47.77 0 0 1 14.1-33.89z"/></g></g></svg>
|
Before Width: | Height: | Size: 4.2 KiB |
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 15 KiB |
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 5.4 KiB |
|
@ -27,7 +27,7 @@ return [
|
|||
'email' => 'البريد الإلكتروني',
|
||||
'password' => 'كلمة المرور',
|
||||
'password_confirm' => 'تأكيد كلمة المرور',
|
||||
'password_hint' => 'يجب أن تكون أكثر من 5 حروف',
|
||||
'password_hint' => 'يجب أن تكون أكثر من 7 حروف',
|
||||
'forgot_password' => 'نسيت كلمة المرور؟',
|
||||
'remember_me' => 'تذكرني',
|
||||
'ldap_email_hint' => 'الرجاء إدخال عنوان بريد إلكتروني لاستخدامه مع الحساب.',
|
||||
|
|
|
@ -21,7 +21,7 @@ return [
|
|||
'email' => 'Email',
|
||||
'password' => 'Heslo',
|
||||
'password_confirm' => 'Potvrdit heslo',
|
||||
'password_hint' => 'Musí mít víc než 5 znaků',
|
||||
'password_hint' => 'Musí mít víc než 7 znaků',
|
||||
'forgot_password' => 'Zapomněli jste heslo?',
|
||||
'remember_me' => 'Neodhlašovat',
|
||||
'ldap_email_hint' => 'Zadejte email, který chcete přiřadit k tomuto účtu.',
|
||||
|
|
|
@ -25,7 +25,7 @@ return [
|
|||
'email' => 'E-Mail',
|
||||
'password' => 'Passwort',
|
||||
'password_confirm' => 'Passwort bestätigen',
|
||||
'password_hint' => 'Mindestlänge: 5 Zeichen',
|
||||
'password_hint' => 'Mindestlänge: 7 Zeichen',
|
||||
'forgot_password' => 'Passwort vergessen?',
|
||||
'remember_me' => 'Angemeldet bleiben',
|
||||
'ldap_email_hint' => 'Bitte geben Sie eine E-Mail-Adresse ein, um diese mit dem Account zu nutzen.',
|
||||
|
|
|
@ -21,7 +21,7 @@ return [
|
|||
'email' => 'Email',
|
||||
'password' => 'Password',
|
||||
'password_confirm' => 'Confirm Password',
|
||||
'password_hint' => 'Must be over 5 characters',
|
||||
'password_hint' => 'Must be over 7 characters',
|
||||
'forgot_password' => 'Forgot Password?',
|
||||
'remember_me' => 'Remember Me',
|
||||
'ldap_email_hint' => 'Please enter an email to use for this account.',
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
return [
|
||||
|
||||
'password' => 'Passwords must be at least six characters and match the confirmation.',
|
||||
'password' => 'Passwords must be at least eight characters and match the confirmation.',
|
||||
'user' => "We can't find a user with that e-mail address.",
|
||||
'token' => 'This password reset token is invalid.',
|
||||
'sent' => 'We have e-mailed your password reset link!',
|
||||
|
|
|
@ -30,6 +30,7 @@ return [
|
|||
'digits' => 'The :attribute must be :digits digits.',
|
||||
'digits_between' => 'The :attribute must be between :min and :max digits.',
|
||||
'email' => 'The :attribute must be a valid email address.',
|
||||
'ends_with' => 'The :attribute must end with one of the following: :values',
|
||||
'filled' => 'The :attribute field is required.',
|
||||
'gt' => [
|
||||
'numeric' => 'The :attribute must be greater than :value.',
|
||||
|
|
|
@ -21,7 +21,7 @@ return [
|
|||
'email' => 'Correo electrónico',
|
||||
'password' => 'Contraseña',
|
||||
'password_confirm' => 'Confirmar Contraseña',
|
||||
'password_hint' => 'Debe contener más de 5 caracteres',
|
||||
'password_hint' => 'Debe contener más de 7 caracteres',
|
||||
'forgot_password' => '¿Contraseña Olvidada?',
|
||||
'remember_me' => 'Recordarme',
|
||||
'ldap_email_hint' => 'Por favor introduzca un mail para utilizar con esta cuenta.',
|
||||
|
|
|
@ -27,7 +27,7 @@ return [
|
|||
'email' => 'Correo electrónico',
|
||||
'password' => 'Contraseña',
|
||||
'password_confirm' => 'Confirmar contraseña',
|
||||
'password_hint' => 'Debe contener al menos 5 caracteres',
|
||||
'password_hint' => 'Debe contener al menos 7 caracteres',
|
||||
'forgot_password' => '¿Olvidó la contraseña?',
|
||||
'remember_me' => 'Recordarme',
|
||||
'ldap_email_hint' => 'Por favor introduzca un correo electrónico para utilizar con esta cuenta.',
|
||||
|
|
|
@ -27,7 +27,7 @@ return [
|
|||
'email' => 'E-mail',
|
||||
'password' => 'Mot de passe',
|
||||
'password_confirm' => 'Confirmez le mot de passe',
|
||||
'password_hint' => 'Doit faire plus de 5 caractères',
|
||||
'password_hint' => 'Doit faire plus de 7 caractères',
|
||||
'forgot_password' => 'Mot de passe oublié ?',
|
||||
'remember_me' => 'Se souvenir de moi',
|
||||
'ldap_email_hint' => "Merci d'entrer une adresse e-mail pour ce compte",
|
||||
|
|
|
@ -21,7 +21,7 @@ return [
|
|||
'email' => 'Email',
|
||||
'password' => 'Jelszó',
|
||||
'password_confirm' => 'Jelszó megerősítése',
|
||||
'password_hint' => 'Öt karakternél hosszabbnak kell lennie',
|
||||
'password_hint' => 'Négy karakternél hosszabbnak kell lennie',
|
||||
'forgot_password' => 'Elfelejtett jelszó?',
|
||||
'remember_me' => 'Emlékezzen rám',
|
||||
'ldap_email_hint' => 'A fiókhoz használt email cím megadása.',
|
||||
|
|
|
@ -27,7 +27,7 @@ return [
|
|||
'email' => 'Email',
|
||||
'password' => 'Password',
|
||||
'password_confirm' => 'Conferma Password',
|
||||
'password_hint' => 'Deve essere più di 5 caratteri',
|
||||
'password_hint' => 'Deve essere più di 7 caratteri',
|
||||
'forgot_password' => 'Password dimenticata?',
|
||||
'remember_me' => 'Ricordami',
|
||||
'ldap_email_hint' => 'Inserisci un email per usare quest\'account.',
|
||||
|
|
|
@ -27,7 +27,7 @@ return [
|
|||
'email' => 'メールアドレス',
|
||||
'password' => 'パスワード',
|
||||
'password_confirm' => 'パスワード (確認)',
|
||||
'password_hint' => '5文字以上である必要があります',
|
||||
'password_hint' => '7文字以上である必要があります',
|
||||
'forgot_password' => 'パスワードをお忘れですか?',
|
||||
'remember_me' => 'ログイン情報を保存する',
|
||||
'ldap_email_hint' => 'このアカウントで使用するEメールアドレスを入力してください。',
|
||||
|
|
|
@ -27,7 +27,7 @@ return [
|
|||
'email' => '이메일',
|
||||
'password' => '비밀번호',
|
||||
'password_confirm' => '비밀번호 (확인)',
|
||||
'password_hint' => '5자 이상이어야 합니다.',
|
||||
'password_hint' => '7자 이상이어야 합니다.',
|
||||
'forgot_password' => '비밀번호를 잊으셨습니까?',
|
||||
'remember_me' => '자동로그인',
|
||||
'ldap_email_hint' => '이 계정에서 사용하는 이메일을 입력해 주세요.',
|
||||
|
|
|
@ -27,7 +27,7 @@ return [
|
|||
'email' => 'Email',
|
||||
'password' => 'Wachtwoord',
|
||||
'password_confirm' => 'Wachtwoord Bevestigen',
|
||||
'password_hint' => 'Minimaal 6 tekens',
|
||||
'password_hint' => 'Minimaal 8 tekens',
|
||||
'forgot_password' => 'Wachtwoord vergeten?',
|
||||
'remember_me' => 'Mij onthouden',
|
||||
'ldap_email_hint' => 'Geef een email op waarmee je dit account wilt gebruiken.',
|
||||
|
|
|
@ -27,7 +27,7 @@ return [
|
|||
'email' => 'E-mail',
|
||||
'password' => 'Hasło',
|
||||
'password_confirm' => 'Potwierdzenie hasła',
|
||||
'password_hint' => 'Musi mieć więcej niż 5 znaków',
|
||||
'password_hint' => 'Musi mieć więcej niż 7 znaków',
|
||||
'forgot_password' => 'Zapomniałem hasła',
|
||||
'remember_me' => 'Zapamiętaj mnie',
|
||||
'ldap_email_hint' => 'Wprowadź adres e-mail dla tego konta.',
|
||||
|
|
|
@ -21,7 +21,7 @@ return [
|
|||
'email' => 'E-mail',
|
||||
'password' => 'Senha',
|
||||
'password_confirm' => 'Confirmar Senha',
|
||||
'password_hint' => 'Senha deverá ser maior que 5 caracteres',
|
||||
'password_hint' => 'Senha deverá ser maior que 7 caracteres',
|
||||
'forgot_password' => 'Esqueceu a senha?',
|
||||
'remember_me' => 'Lembrar de mim',
|
||||
'ldap_email_hint' => 'Por favor, digite um e-mail para essa conta.',
|
||||
|
|
|
@ -27,7 +27,7 @@ return [
|
|||
'email' => 'Email',
|
||||
'password' => 'Пароль',
|
||||
'password_confirm' => 'Подтверждение пароля',
|
||||
'password_hint' => 'Должен быть больше 5 символов',
|
||||
'password_hint' => 'Должен быть больше 7 символов',
|
||||
'forgot_password' => 'Забыли пароль?',
|
||||
'remember_me' => 'Запомнить меня',
|
||||
'ldap_email_hint' => 'Введите email адрес для данной учетной записи.',
|
||||
|
|
|
@ -27,7 +27,7 @@ return [
|
|||
'email' => 'Email',
|
||||
'password' => 'Heslo',
|
||||
'password_confirm' => 'Potvrdiť heslo',
|
||||
'password_hint' => 'Musí mať viac ako 5 znakov',
|
||||
'password_hint' => 'Musí mať viac ako 7 znakov',
|
||||
'forgot_password' => 'Zabudli ste heslo?',
|
||||
'remember_me' => 'Zapamätať si ma',
|
||||
'ldap_email_hint' => 'Zadajte prosím email, ktorý sa má použiť pre tento účet.',
|
||||
|
|
|
@ -27,7 +27,7 @@ return [
|
|||
'email' => 'E-post',
|
||||
'password' => 'Lösenord',
|
||||
'password_confirm' => 'Bekräfta lösenord',
|
||||
'password_hint' => 'Måste vara fler än 5 tecken',
|
||||
'password_hint' => 'Måste vara fler än 7 tecken',
|
||||
'forgot_password' => 'Glömt lösenord?',
|
||||
'remember_me' => 'Kom ihåg mig',
|
||||
'ldap_email_hint' => 'Vänligen ange en e-postadress att använda till kontot.',
|
||||
|
|
|
@ -21,7 +21,7 @@ return [
|
|||
'email' => 'Email',
|
||||
'password' => 'Пароль',
|
||||
'password_confirm' => 'Підтвердження пароля',
|
||||
'password_hint' => 'Має бути більше 5 символів',
|
||||
'password_hint' => 'Має бути більше 7 символів',
|
||||
'forgot_password' => 'Забули пароль?',
|
||||
'remember_me' => 'Запам’ятати мене',
|
||||
'ldap_email_hint' => 'Введіть email для цього облікового запису.',
|
||||
|
|
|
@ -27,7 +27,7 @@ return [
|
|||
'email' => 'Email地址',
|
||||
'password' => '密码',
|
||||
'password_confirm' => '确认密码',
|
||||
'password_hint' => '必须超过5个字符',
|
||||
'password_hint' => '必须超过7个字符',
|
||||
'forgot_password' => '忘记密码?',
|
||||
'remember_me' => '记住我',
|
||||
'ldap_email_hint' => '请输入用于此帐户的电子邮件。',
|
||||
|
|
|
@ -27,7 +27,7 @@ return [
|
|||
'email' => 'Email位址',
|
||||
'password' => '密碼',
|
||||
'password_confirm' => '確認密碼',
|
||||
'password_hint' => '必須超過5個字元',
|
||||
'password_hint' => '必須超過7個字元',
|
||||
'forgot_password' => '忘記密碼?',
|
||||
'remember_me' => '記住我',
|
||||
'ldap_email_hint' => '請輸入用於此帳號的電子郵件。',
|
||||
|
|
2
storage/framework/cache/data/.gitignore
vendored
2
storage/framework/cache/data/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
*
|
||||
!.gitignore
|
|
@ -81,7 +81,7 @@ class AuthTest extends BrowserKitTest
|
|||
->press('Create Account')
|
||||
->see('The name must be at least 2 characters.')
|
||||
->see('The email must be a valid email address.')
|
||||
->see('The password must be at least 6 characters.')
|
||||
->see('The password must be at least 8 characters.')
|
||||
->seePageIs('/register');
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ class LdapTest extends BrowserKitTest
|
|||
protected $mockUser;
|
||||
protected $resourceId = 'resource-test';
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
if (!defined('LDAP_OPT_REFERRALS')) define('LDAP_OPT_REFERRALS', 1);
|
||||
|
|
|
@ -6,6 +6,7 @@ use BookStack\Auth\User;
|
|||
use BookStack\Notifications\UserInvite;
|
||||
use Carbon\Carbon;
|
||||
use DB;
|
||||
use Illuminate\Support\Str;
|
||||
use Notification;
|
||||
|
||||
class UserInviteTest extends TestCase
|
||||
|
@ -68,11 +69,13 @@ class UserInviteTest extends TestCase
|
|||
$inviteService->sendInvitation($user);
|
||||
$token = DB::table('user_invites')->where('user_id', '=', $user->id)->first()->token;
|
||||
|
||||
$this->get('/register/invite/' . $token);
|
||||
$shortPassword = $this->followingRedirects()->post('/register/invite/' . $token, [
|
||||
'password' => 'mypas',
|
||||
'password' => 'mypassw',
|
||||
]);
|
||||
$shortPassword->assertSee('The password must be at least 6 characters.');
|
||||
$shortPassword->assertSee('The password must be at least 8 characters.');
|
||||
|
||||
$this->get('/register/invite/' . $token);
|
||||
$noPassword = $this->followingRedirects()->post('/register/invite/' . $token, [
|
||||
'password' => '',
|
||||
]);
|
||||
|
@ -85,10 +88,10 @@ class UserInviteTest extends TestCase
|
|||
|
||||
public function test_non_existent_invite_token_redirects_to_home()
|
||||
{
|
||||
$setPasswordPageResp = $this->get('/register/invite/' . str_random(12));
|
||||
$setPasswordPageResp = $this->get('/register/invite/' . Str::random(12));
|
||||
$setPasswordPageResp->assertRedirect('/');
|
||||
|
||||
$setPasswordResp = $this->post('/register/invite/' . str_random(12), ['password' => 'Password Test']);
|
||||
$setPasswordResp = $this->post('/register/invite/' . Str::random(12), ['password' => 'Password Test']);
|
||||
$setPasswordResp->assertRedirect('/');
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ abstract class BrowserKitTest extends TestCase
|
|||
*/
|
||||
protected $baseUrl = 'http://localhost';
|
||||
|
||||
public function tearDown()
|
||||
public function tearDown() : void
|
||||
{
|
||||
\DB::disconnect();
|
||||
parent::tearDown();
|
||||
|
|
|
@ -4,6 +4,7 @@ use BookStack\Auth\Role;
|
|||
use BookStack\Auth\User;
|
||||
use BookStack\Entities\Book;
|
||||
use BookStack\Entities\Bookshelf;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class BookShelfTest extends TestCase
|
||||
{
|
||||
|
@ -55,8 +56,8 @@ class BookShelfTest extends TestCase
|
|||
{
|
||||
$booksToInclude = Book::take(2)->get();
|
||||
$shelfInfo = [
|
||||
'name' => 'My test book' . str_random(4),
|
||||
'description' => 'Test book description ' . str_random(10)
|
||||
'name' => 'My test book' . Str::random(4),
|
||||
'description' => 'Test book description ' . Str::random(10)
|
||||
];
|
||||
$resp = $this->asEditor()->post('/shelves', array_merge($shelfInfo, [
|
||||
'books' => $booksToInclude->implode('id', ','),
|
||||
|
@ -120,8 +121,8 @@ class BookShelfTest extends TestCase
|
|||
|
||||
$booksToInclude = Book::take(2)->get();
|
||||
$shelfInfo = [
|
||||
'name' => 'My test book' . str_random(4),
|
||||
'description' => 'Test book description ' . str_random(10)
|
||||
'name' => 'My test book' . Str::random(4),
|
||||
'description' => 'Test book description ' . Str::random(10)
|
||||
];
|
||||
|
||||
$resp = $this->asEditor()->put($shelf->getUrl(), array_merge($shelfInfo, [
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class CommentSettingTest extends BrowserKitTest {
|
||||
protected $page;
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
parent::setUp();
|
||||
$this->page = \BookStack\Entities\Page::first();
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
use BookStack\Entities\Chapter;
|
||||
use BookStack\Entities\Page;
|
||||
use BookStack\Uploads\HttpFetcher;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ExportTest extends TestCase
|
||||
{
|
||||
|
@ -79,7 +80,7 @@ class ExportTest extends TestCase
|
|||
|
||||
public function test_book_html_export_shows_chapter_descriptions()
|
||||
{
|
||||
$chapterDesc = 'My custom test chapter description ' . str_random(12);
|
||||
$chapterDesc = 'My custom test chapter description ' . Str::random(12);
|
||||
$chapter = Chapter::query()->first();
|
||||
$chapter->description = $chapterDesc;
|
||||
$chapter->save();
|
||||
|
|
|
@ -4,7 +4,7 @@ class MarkdownTest extends BrowserKitTest
|
|||
{
|
||||
protected $page;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->page = \BookStack\Entities\Page::first();
|
||||
|
|
|
@ -8,7 +8,7 @@ class PageDraftTest extends BrowserKitTest
|
|||
protected $page;
|
||||
protected $pageRepo;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->page = \BookStack\Entities\Page::first();
|
||||
|
|
|
@ -10,7 +10,7 @@ class SortTest extends TestCase
|
|||
{
|
||||
protected $book;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->book = Book::first();
|
||||
|
|
|
@ -8,7 +8,7 @@ class LanguageTest extends TestCase
|
|||
/**
|
||||
* LanguageTest constructor.
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->langs = array_diff(scandir(resource_path('lang')), ['..', '.', 'check.php', 'format.php']);
|
||||
|
|
|
@ -21,7 +21,7 @@ class RestrictionsTest extends BrowserKitTest
|
|||
*/
|
||||
protected $viewer;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->user = $this->getEditor();
|
||||
|
|
|
@ -11,7 +11,7 @@ class RolesTest extends BrowserKitTest
|
|||
{
|
||||
protected $user;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->user = $this->getViewer();
|
||||
|
|
|
@ -50,11 +50,14 @@ class ConfigTest extends TestCase
|
|||
protected function checkEnvConfigResult(string $envName, $envVal, string $configKey, string $expectedResult)
|
||||
{
|
||||
$originalVal = getenv($envName);
|
||||
|
||||
$envString = $envName . (is_null($envVal) ? '' : '=') . ($envVal ?? '');
|
||||
putenv($envString);
|
||||
$this->refreshApplication();
|
||||
$this->assertEquals($expectedResult, config($configKey));
|
||||
putenv($envString = $envName . (empty($originalVal) ? '' : '=') . ($originalVal ?? ''));
|
||||
|
||||
$envString = $envName . (empty($originalVal) ? '' : '=') . ($originalVal ?? '');
|
||||
putenv($envString);
|
||||
}
|
||||
|
||||
}
|
|
@ -10,7 +10,7 @@ class PageRepoTest extends TestCase
|
|||
*/
|
||||
protected $pageRepo;
|
||||
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->pageRepo = app()->make(PageRepo::class);
|
||||
|
|
|
@ -4,6 +4,7 @@ use BookStack\Entities\Repos\PageRepo;
|
|||
use BookStack\Uploads\Image;
|
||||
use BookStack\Entities\Page;
|
||||
use BookStack\Uploads\ImageService;
|
||||
use Illuminate\Support\Str;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ImageTest extends TestCase
|
||||
|
@ -43,7 +44,7 @@ class ImageTest extends TestCase
|
|||
$imgDetails = $this->uploadGalleryImage();
|
||||
$image = Image::query()->first();
|
||||
|
||||
$newName = str_random();
|
||||
$newName = Str::random();
|
||||
$update = $this->put('/images/' . $image->id, ['name' => $newName]);
|
||||
$update->assertSuccessful();
|
||||
$update->assertJson([
|
||||
|
@ -89,7 +90,7 @@ class ImageTest extends TestCase
|
|||
$searchHitRequest = $this->get("/images/gallery?page=1&uploaded_to={$pageId}&search={$namePartial}");
|
||||
$searchHitRequest->assertSuccessful()->assertJson($resultJson);
|
||||
|
||||
$namePartial = str_random(16);
|
||||
$namePartial = Str::random(16);
|
||||
$searchHitRequest = $this->get("/images/gallery?page=1&uploaded_to={$pageId}&search={$namePartial}");
|
||||
$searchHitRequest->assertSuccessful()->assertExactJson($emptyJson);
|
||||
}
|
||||
|
@ -208,7 +209,7 @@ class ImageTest extends TestCase
|
|||
|
||||
$encodedImageContent = base64_encode(file_get_contents($expectedPath));
|
||||
$export = $this->get($page->getUrl('/export/html'));
|
||||
$this->assertTrue(str_contains($export->getContent(), $encodedImageContent), 'Uploaded image in export content');
|
||||
$this->assertTrue(strpos($export->getContent(), $encodedImageContent) !== false, 'Uploaded image in export content');
|
||||
|
||||
if (file_exists($expectedPath)) {
|
||||
unlink($expectedPath);
|
||||
|
|
|
@ -4,7 +4,7 @@ class UserProfileTest extends BrowserKitTest
|
|||
{
|
||||
protected $user;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->user = \BookStack\Auth\User::all()->last();
|
||||
|
|
Loading…
Reference in New Issue
Block a user