1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-09 10:22:51 +03:00

Re-structured the app code to be feature based rather than code type based

This commit is contained in:
Dan Brown
2018-09-25 12:30:50 +01:00
parent 19751ed1cb
commit 919660678b
109 changed files with 684 additions and 531 deletions

View File

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

View File

@@ -5,7 +5,7 @@ class CommentSettingTest extends BrowserKitTest {
public function setUp() {
parent::setUp();
$this->page = \BookStack\Page::first();
$this->page = \BookStack\Entities\Page::first();
}
public function test_comment_disable () {

View File

@@ -1,7 +1,7 @@
<?php namespace Tests;
use BookStack\Page;
use BookStack\Comment;
use BookStack\Entities\Page;
use BookStack\Actions\Comment;
class CommentTest extends TestCase
{
@@ -23,7 +23,7 @@ class CommentTest extends TestCase
$this->assertDatabaseHas('comments', [
'local_id' => 1,
'entity_id' => $page->id,
'entity_type' => 'BookStack\\Page',
'entity_type' => Page::newModelInstance()->getMorphClass(),
'text' => $comment->text,
'parent_id' => 2
]);

View File

@@ -1,16 +1,16 @@
<?php namespace Tests;
use BookStack\Bookshelf;
use BookStack\Chapter;
use BookStack\Page;
use BookStack\Entities\Bookshelf;
use BookStack\Entities\Chapter;
use BookStack\Entities\Page;
class EntitySearchTest extends TestCase
{
public function test_page_search()
{
$book = \BookStack\Book::all()->first();
$book = \BookStack\Entities\Book::all()->first();
$page = $book->pages->first();
$search = $this->asEditor()->get('/search?term=' . urlencode($page->name));
@@ -54,7 +54,7 @@ class EntitySearchTest extends TestCase
public function test_book_search()
{
$book = \BookStack\Book::first();
$book = \BookStack\Entities\Book::first();
$page = $book->pages->last();
$chapter = $book->chapters->last();
@@ -67,7 +67,7 @@ class EntitySearchTest extends TestCase
public function test_chapter_search()
{
$chapter = \BookStack\Chapter::has('pages')->first();
$chapter = \BookStack\Entities\Chapter::has('pages')->first();
$page = $chapter->pages[0];
$pageTestResp = $this->asEditor()->get('/search/chapter/' . $chapter->id . '?term=' . urlencode($page->name));
@@ -77,11 +77,11 @@ class EntitySearchTest extends TestCase
public function test_tag_search()
{
$newTags = [
new \BookStack\Tag([
new \BookStack\Actions\Tag([
'name' => 'animal',
'value' => 'cat'
]),
new \BookStack\Tag([
new \BookStack\Actions\Tag([
'name' => 'color',
'value' => 'red'
])

View File

@@ -1,10 +1,10 @@
<?php namespace Tests;
use BookStack\Book;
use BookStack\Chapter;
use BookStack\Page;
use BookStack\Repos\EntityRepo;
use BookStack\Repos\UserRepo;
use BookStack\Entities\Book;
use BookStack\Entities\Chapter;
use BookStack\Entities\Page;
use BookStack\Entities\EntityRepo;
use BookStack\Auth\UserRepo;
use Carbon\Carbon;
class EntityTest extends BrowserKitTest

View File

@@ -1,8 +1,8 @@
<?php namespace Tests;
use BookStack\Chapter;
use BookStack\Page;
use BookStack\Entities\Chapter;
use BookStack\Entities\Page;
class ExportTest extends TestCase
{

View File

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

View File

@@ -1,7 +1,7 @@
<?php namespace Tests;
use BookStack\Page;
use BookStack\Repos\EntityRepo;
use BookStack\Entities\Page;
use BookStack\Entities\EntityRepo;
class PageContentTest extends TestCase
{

View File

@@ -9,8 +9,8 @@ class PageDraftTest extends BrowserKitTest
public function setUp()
{
parent::setUp();
$this->page = \BookStack\Page::first();
$this->entityRepo = app('\BookStack\Repos\EntityRepo');
$this->page = \BookStack\Entities\Page::first();
$this->entityRepo = app('\BookStack\Entities\EntityRepo');
}
public function test_draft_content_shows_if_available()
@@ -48,7 +48,7 @@ class PageDraftTest extends BrowserKitTest
public function test_alert_message_shows_if_someone_else_editing()
{
$nonEditedPage = \BookStack\Page::take(10)->get()->last();
$nonEditedPage = \BookStack\Entities\Page::take(10)->get()->last();
$addedContent = '<p>test message content</p>';
$this->asAdmin()->visit($this->page->getUrl() . '/edit')
->dontSeeInField('html', $addedContent);
@@ -67,7 +67,7 @@ class PageDraftTest extends BrowserKitTest
public function test_draft_pages_show_on_homepage()
{
$book = \BookStack\Book::first();
$book = \BookStack\Entities\Book::first();
$this->asAdmin()->visit('/')
->dontSeeInElement('#recent-drafts', 'New Page')
->visit($book->getUrl() . '/create-page')
@@ -77,7 +77,7 @@ class PageDraftTest extends BrowserKitTest
public function test_draft_pages_not_visible_by_others()
{
$book = \BookStack\Book::first();
$book = \BookStack\Entities\Book::first();
$chapter = $book->chapters->first();
$newUser = $this->getEditor();

View File

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

View File

@@ -1,9 +1,9 @@
<?php namespace Tests;
use BookStack\Book;
use BookStack\Chapter;
use BookStack\Page;
use BookStack\Repos\EntityRepo;
use BookStack\Entities\Book;
use BookStack\Entities\Chapter;
use BookStack\Entities\Page;
use BookStack\Entities\EntityRepo;
class SortTest extends TestCase
{

View File

@@ -1,10 +1,10 @@
<?php namespace Tests;
use BookStack\Book;
use BookStack\Chapter;
use BookStack\Tag;
use BookStack\Page;
use BookStack\Services\PermissionService;
use BookStack\Entities\Book;
use BookStack\Entities\Chapter;
use BookStack\Actions\Tag;
use BookStack\Entities\Page;
use BookStack\Auth\Permissions\PermissionService;
class TagTest extends BrowserKitTest
{
@@ -13,7 +13,7 @@ class TagTest extends BrowserKitTest
/**
* Get an instance of a page that has many tags.
* @param Tag[]|bool $tags
* @param \BookStack\Actions\Tag[]|bool $tags
* @return mixed
*/
protected function getEntityWithTags($class, $tags = false)