1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-30 04:23:11 +03:00

Fixed some mis-refactoring and split search service

Search service broken into index and runner tools.
This commit is contained in:
Dan Brown
2020-11-22 00:17:45 +00:00
parent c7a2d568bf
commit ef1b98019a
108 changed files with 399 additions and 379 deletions

View File

@ -1,7 +1,7 @@
<?php namespace Tests;
use BookStack\Entities\Book;
use BookStack\Entities\Models\Book;
class ActivityTrackingTest extends BrowserKitTest
{

View File

@ -1,6 +1,6 @@
<?php namespace Tests\Api;
use BookStack\Entities\Book;
use BookStack\Entities\Models\Book;
use Tests\TestCase;
class ApiListingTest extends TestCase

View File

@ -1,6 +1,6 @@
<?php namespace Tests\Api;
use BookStack\Entities\Book;
use BookStack\Entities\Models\Book;
use Tests\TestCase;
class BooksApiTest extends TestCase

View File

@ -1,7 +1,7 @@
<?php namespace Tests\Api;
use BookStack\Entities\Book;
use BookStack\Entities\Chapter;
use BookStack\Entities\Models\Book;
use BookStack\Entities\Models\Chapter;
use Tests\TestCase;
class ChaptersApiTest extends TestCase

View File

@ -1,7 +1,7 @@
<?php namespace Tests\Api;
use BookStack\Entities\Book;
use BookStack\Entities\Bookshelf;
use BookStack\Entities\Models\Book;
use BookStack\Entities\Models\Bookshelf;
use Tests\TestCase;
class ShelvesApiTest extends TestCase

View File

@ -5,7 +5,7 @@ use BookStack\Actions\ActivityService;
use BookStack\Actions\ActivityType;
use BookStack\Auth\UserRepo;
use BookStack\Entities\Tools\TrashCan;
use BookStack\Entities\Page;
use BookStack\Entities\Models\Page;
use BookStack\Entities\Repos\PageRepo;
use Carbon\Carbon;

View File

@ -2,7 +2,7 @@
use BookStack\Auth\Role;
use BookStack\Auth\User;
use BookStack\Entities\Page;
use BookStack\Entities\Models\Page;
use BookStack\Notifications\ConfirmEmail;
use BookStack\Notifications\ResetPassword;
use BookStack\Settings\SettingService;

View File

@ -1,6 +1,6 @@
<?php namespace Tests;
use BookStack\Entities\Entity;
use BookStack\Entities\Models\Entity;
use BookStack\Auth\Role;
use BookStack\Auth\Permissions\PermissionService;
use BookStack\Settings\SettingService;
@ -71,9 +71,9 @@ abstract class BrowserKitTest extends TestCase
protected function createEntityChainBelongingToUser($creatorUser, $updaterUser = false)
{
if ($updaterUser === false) $updaterUser = $creatorUser;
$book = factory(\BookStack\Entities\Book::class)->create(['created_by' => $creatorUser->id, 'updated_by' => $updaterUser->id]);
$chapter = factory(\BookStack\Entities\Chapter::class)->create(['created_by' => $creatorUser->id, 'updated_by' => $updaterUser->id, 'book_id' => $book->id]);
$page = factory(\BookStack\Entities\Page::class)->create(['created_by' => $creatorUser->id, 'updated_by' => $updaterUser->id, 'book_id' => $book->id, 'chapter_id' => $chapter->id]);
$book = factory(\BookStack\Entities\Models\Book::class)->create(['created_by' => $creatorUser->id, 'updated_by' => $updaterUser->id]);
$chapter = factory(\BookStack\Entities\Models\Chapter::class)->create(['created_by' => $creatorUser->id, 'updated_by' => $updaterUser->id, 'book_id' => $book->id]);
$page = factory(\BookStack\Entities\Models\Page::class)->create(['created_by' => $creatorUser->id, 'updated_by' => $updaterUser->id, 'book_id' => $book->id, 'chapter_id' => $chapter->id]);
$restrictionService = $this->app[PermissionService::class];
$restrictionService->buildJointPermissionsForEntity($book);
return [

View File

@ -4,8 +4,8 @@ use BookStack\Actions\ActivityType;
use BookStack\Actions\Comment;
use BookStack\Actions\CommentRepo;
use BookStack\Auth\Permissions\JointPermission;
use BookStack\Entities\Bookshelf;
use BookStack\Entities\Page;
use BookStack\Entities\Models\Bookshelf;
use BookStack\Entities\Models\Page;
use BookStack\Auth\User;
use BookStack\Entities\Repos\PageRepo;
use Symfony\Component\Console\Exception\RuntimeException;

View File

@ -1,8 +1,8 @@
<?php namespace Tests\Entity;
use BookStack\Auth\User;
use BookStack\Entities\Book;
use BookStack\Entities\Bookshelf;
use BookStack\Entities\Models\Book;
use BookStack\Entities\Models\Bookshelf;
use BookStack\Uploads\Image;
use Illuminate\Support\Str;
use Tests\TestCase;

View File

@ -1,6 +1,6 @@
<?php namespace Tests\Entity;
use BookStack\Entities\Book;
use BookStack\Entities\Models\Book;
use Tests\TestCase;
class BookTest extends TestCase

View File

@ -1,6 +1,6 @@
<?php namespace Tests\Entity;
use BookStack\Entities\Chapter;
use BookStack\Entities\Models\Chapter;
use Tests\TestCase;
class ChapterTest extends TestCase

View File

@ -1,6 +1,6 @@
<?php namespace Tests\Entity;
use BookStack\Entities\Page;
use BookStack\Entities\Models\Page;
use Tests\BrowserKitTest;
class CommentSettingTest extends BrowserKitTest

View File

@ -1,6 +1,6 @@
<?php namespace Tests\Entity;
use BookStack\Entities\Page;
use BookStack\Entities\Models\Page;
use BookStack\Actions\Comment;
use Tests\TestCase;

View File

@ -1,10 +1,10 @@
<?php namespace Tests\Entity;
use BookStack\Actions\Tag;
use BookStack\Entities\Book;
use BookStack\Entities\Bookshelf;
use BookStack\Entities\Chapter;
use BookStack\Entities\Page;
use BookStack\Entities\Models\Book;
use BookStack\Entities\Models\Bookshelf;
use BookStack\Entities\Models\Chapter;
use BookStack\Entities\Models\Page;
use Tests\TestCase;
class EntitySearchTest extends TestCase

View File

@ -1,9 +1,9 @@
<?php namespace Tests\Entity;
use BookStack\Entities\Bookshelf;
use BookStack\Entities\Book;
use BookStack\Entities\Chapter;
use BookStack\Entities\Page;
use BookStack\Entities\Models\Bookshelf;
use BookStack\Entities\Models\Book;
use BookStack\Entities\Models\Chapter;
use BookStack\Entities\Models\Page;
use BookStack\Auth\UserRepo;
use BookStack\Entities\Repos\PageRepo;
use Carbon\Carbon;

View File

@ -1,8 +1,8 @@
<?php namespace Tests\Entity;
use BookStack\Entities\Chapter;
use BookStack\Entities\Page;
use BookStack\Entities\Models\Chapter;
use BookStack\Entities\Models\Page;
use BookStack\Uploads\HttpFetcher;
use Illuminate\Support\Str;
use Tests\TestCase;

View File

@ -9,7 +9,7 @@ class MarkdownTest extends BrowserKitTest
public function setUp(): void
{
parent::setUp();
$this->page = \BookStack\Entities\Page::first();
$this->page = \BookStack\Entities\Models\Page::first();
}
protected function setMarkdownEditor()

View File

@ -1,7 +1,7 @@
<?php namespace Tests\Entity;
use BookStack\Entities\Tools\PageContent;
use BookStack\Entities\Page;
use BookStack\Entities\Models\Page;
use Tests\TestCase;
class PageContentTest extends TestCase

View File

@ -1,6 +1,6 @@
<?php namespace Tests\Entity;
use BookStack\Entities\Page;
use BookStack\Entities\Models\Page;
use BookStack\Entities\Repos\PageRepo;
use Tests\BrowserKitTest;
@ -16,7 +16,7 @@ class PageDraftTest extends BrowserKitTest
public function setUp(): void
{
parent::setUp();
$this->page = \BookStack\Entities\Page::first();
$this->page = \BookStack\Entities\Models\Page::first();
$this->pageRepo = app(PageRepo::class);
}
@ -56,7 +56,7 @@ class PageDraftTest extends BrowserKitTest
public function test_alert_message_shows_if_someone_else_editing()
{
$nonEditedPage = \BookStack\Entities\Page::take(10)->get()->last();
$nonEditedPage = \BookStack\Entities\Models\Page::take(10)->get()->last();
$addedContent = '<p>test message content</p>';
$this->asAdmin()->visit($this->page->getUrl('/edit'))
->dontSeeInField('html', $addedContent);
@ -75,7 +75,7 @@ class PageDraftTest extends BrowserKitTest
public function test_draft_pages_show_on_homepage()
{
$book = \BookStack\Entities\Book::first();
$book = \BookStack\Entities\Models\Book::first();
$this->asAdmin()->visit('/')
->dontSeeInElement('#recent-drafts', 'New Page')
->visit($book->getUrl() . '/create-page')
@ -85,7 +85,7 @@ class PageDraftTest extends BrowserKitTest
public function test_draft_pages_not_visible_by_others()
{
$book = \BookStack\Entities\Book::first();
$book = \BookStack\Entities\Models\Book::first();
$chapter = $book->chapters->first();
$newUser = $this->getEditor();

View File

@ -1,6 +1,6 @@
<?php namespace Tests\Entity;
use BookStack\Entities\Page;
use BookStack\Entities\Models\Page;
use BookStack\Entities\Repos\PageRepo;
use Tests\TestCase;

View File

@ -1,6 +1,6 @@
<?php namespace Tests\Entity;
use BookStack\Entities\Page;
use BookStack\Entities\Models\Page;
use Tests\TestCase;
class PageTemplateTest extends TestCase

View File

@ -1,6 +1,6 @@
<?php namespace Tests\Entity;
use BookStack\Entities\Page;
use BookStack\Entities\Models\Page;
use Tests\TestCase;
class PageTest extends TestCase

View File

@ -1,6 +1,6 @@
<?php namespace Tests\Entity;
use BookStack\Entities\SearchOptions;
use BookStack\Entities\Tools\SearchOptions;
use Tests\TestCase;
class SearchOptionsTest extends TestCase

View File

@ -1,8 +1,8 @@
<?php namespace Tests\Entity;
use BookStack\Entities\Book;
use BookStack\Entities\Chapter;
use BookStack\Entities\Page;
use BookStack\Entities\Models\Book;
use BookStack\Entities\Models\Chapter;
use BookStack\Entities\Models\Page;
use BookStack\Entities\Repos\PageRepo;
use Tests\TestCase;

View File

@ -1,10 +1,10 @@
<?php namespace Tests\Entity;
use BookStack\Entities\Book;
use BookStack\Entities\Chapter;
use BookStack\Entities\Models\Book;
use BookStack\Entities\Models\Chapter;
use BookStack\Actions\Tag;
use BookStack\Entities\Entity;
use BookStack\Entities\Page;
use BookStack\Entities\Models\Entity;
use BookStack\Entities\Models\Page;
use BookStack\Auth\Permissions\PermissionService;
use Tests\BrowserKitTest;

View File

@ -1,6 +1,6 @@
<?php namespace Tests;
use BookStack\Entities\Book;
use BookStack\Entities\Models\Book;
use Illuminate\Support\Facades\Log;
class ErrorTest extends TestCase

View File

@ -1,6 +1,6 @@
<?php namespace Tests;
use BookStack\Entities\Bookshelf;
use BookStack\Entities\Models\Bookshelf;
class HomepageTest extends TestCase
{

View File

@ -1,11 +1,11 @@
<?php namespace Tests\Permissions;
use BookStack\Entities\Book;
use BookStack\Entities\Bookshelf;
use BookStack\Entities\Chapter;
use BookStack\Entities\Entity;
use BookStack\Entities\Models\Book;
use BookStack\Entities\Models\Bookshelf;
use BookStack\Entities\Models\Chapter;
use BookStack\Entities\Models\Entity;
use BookStack\Auth\User;
use BookStack\Entities\Page;
use BookStack\Entities\Models\Page;
use Tests\BrowserKitTest;
class RestrictionsTest extends BrowserKitTest

View File

@ -2,10 +2,10 @@
use BookStack\Actions\Comment;
use BookStack\Auth\User;
use BookStack\Entities\Book;
use BookStack\Entities\Bookshelf;
use BookStack\Entities\Chapter;
use BookStack\Entities\Page;
use BookStack\Entities\Models\Book;
use BookStack\Entities\Models\Bookshelf;
use BookStack\Entities\Models\Chapter;
use BookStack\Entities\Models\Page;
use BookStack\Auth\Role;
use BookStack\Uploads\Image;
use Laravel\BrowserKitTesting\HttpException;

View File

@ -5,9 +5,9 @@ use BookStack\Auth\Permissions\PermissionService;
use BookStack\Auth\Permissions\RolePermission;
use BookStack\Auth\Role;
use BookStack\Auth\User;
use BookStack\Entities\Book;
use BookStack\Entities\Chapter;
use BookStack\Entities\Page;
use BookStack\Entities\Models\Book;
use BookStack\Entities\Models\Chapter;
use BookStack\Entities\Models\Page;
class PublicActionTest extends BrowserKitTest
{

View File

@ -1,8 +1,8 @@
<?php namespace Tests;
use BookStack\Entities\Book;
use BookStack\Entities\Deletion;
use BookStack\Entities\Page;
use BookStack\Entities\Models\Book;
use BookStack\Entities\Models\Deletion;
use BookStack\Entities\Models\Page;
use DB;
use Illuminate\Support\Carbon;

View File

@ -1,11 +1,11 @@
<?php namespace Tests;
use BookStack\Auth\User;
use BookStack\Entities\Book;
use BookStack\Entities\Bookshelf;
use BookStack\Entities\Chapter;
use BookStack\Entities\Entity;
use BookStack\Entities\Page;
use BookStack\Entities\Models\Book;
use BookStack\Entities\Models\Bookshelf;
use BookStack\Entities\Models\Chapter;
use BookStack\Entities\Models\Entity;
use BookStack\Entities\Models\Page;
use BookStack\Entities\Repos\BookRepo;
use BookStack\Entities\Repos\BookshelfRepo;
use BookStack\Entities\Repos\ChapterRepo;

View File

@ -1,6 +1,6 @@
<?php namespace Tests;
use BookStack\Entities\Entity;
use BookStack\Entities\Models\Entity;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;

View File

@ -3,7 +3,7 @@
use BookStack\Entities\Tools\TrashCan;
use BookStack\Entities\Repos\PageRepo;
use BookStack\Uploads\Attachment;
use BookStack\Entities\Page;
use BookStack\Entities\Models\Page;
use BookStack\Auth\Permissions\PermissionService;
use BookStack\Uploads\AttachmentService;
use Illuminate\Http\UploadedFile;

View File

@ -1,6 +1,6 @@
<?php namespace Tests\Uploads;
use BookStack\Entities\Page;
use BookStack\Entities\Models\Page;
use BookStack\Uploads\Image;
use Tests\TestCase;

View File

@ -2,7 +2,7 @@
use BookStack\Entities\Repos\PageRepo;
use BookStack\Uploads\Image;
use BookStack\Entities\Page;
use BookStack\Entities\Models\Page;
use BookStack\Uploads\ImageService;
use Illuminate\Support\Str;
use Tests\TestCase;

View File

@ -1,6 +1,6 @@
<?php namespace Tests\Uploads;
use BookStack\Entities\Page;
use BookStack\Entities\Models\Page;
use Illuminate\Http\UploadedFile;
trait UsesImages

View File

@ -3,7 +3,7 @@
use Activity;
use BookStack\Actions\ActivityType;
use BookStack\Auth\User;
use BookStack\Entities\Bookshelf;
use BookStack\Entities\Models\Bookshelf;
use Tests\BrowserKitTest;
class UserProfileTest extends BrowserKitTest