0
0
Fork 0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-04-15 17:24:11 +00:00

Updated test files to be PSR-4 compliant

Closes 
This commit is contained in:
Dan Brown 2020-04-04 01:16:05 +01:00
parent 3500182c5f
commit f84bf8e883
No known key found for this signature in database
GPG key ID: 46D9F943C24A2EF9
33 changed files with 89 additions and 62 deletions

View file

@ -1,10 +1,9 @@
<?php <?php namespace Tests\Api;
namespace Tests;
use BookStack\Auth\Permissions\RolePermission; use BookStack\Auth\Permissions\RolePermission;
use BookStack\Auth\User; use BookStack\Auth\User;
use Carbon\Carbon; use Carbon\Carbon;
use Tests\TestCase;
class ApiAuthTest extends TestCase class ApiAuthTest extends TestCase
{ {

View file

@ -1,9 +1,6 @@
<?php <?php namespace Tests\Api;
namespace Tests; use Tests\TestCase;
use BookStack\Auth\Permissions\RolePermission;
use Carbon\Carbon;
class ApiConfigTest extends TestCase class ApiConfigTest extends TestCase
{ {

View file

@ -1,6 +1,6 @@
<?php <?php namespace Tests\Api;
namespace Tests; use Tests\TestCase;
class ApiDocsTest extends TestCase class ApiDocsTest extends TestCase
{ {

View file

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

View file

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

View file

@ -1,6 +1,4 @@
<?php <?php namespace Tests\Api;
namespace Tests;
trait TestsApi trait TestsApi
{ {

View file

@ -1,10 +1,11 @@
<?php namespace Tests; <?php namespace Tests\Auth;
use BookStack\Auth\User; use BookStack\Auth\User;
use BookStack\Entities\Page; use BookStack\Entities\Page;
use BookStack\Notifications\ConfirmEmail; use BookStack\Notifications\ConfirmEmail;
use BookStack\Settings\SettingService; use BookStack\Settings\SettingService;
use Illuminate\Support\Facades\Notification; use Illuminate\Support\Facades\Notification;
use Tests\BrowserKitTest;
class AuthTest extends BrowserKitTest class AuthTest extends BrowserKitTest
{ {

View file

@ -1,10 +1,11 @@
<?php namespace Tests; <?php namespace Tests\Auth;
use BookStack\Auth\Access\LdapService; use BookStack\Auth\Access\LdapService;
use BookStack\Auth\Role; use BookStack\Auth\Role;
use BookStack\Auth\Access\Ldap; use BookStack\Auth\Access\Ldap;
use BookStack\Auth\User; use BookStack\Auth\User;
use Mockery\MockInterface; use Mockery\MockInterface;
use Tests\BrowserKitTest;
class LdapTest extends BrowserKitTest class LdapTest extends BrowserKitTest
{ {

View file

@ -1,7 +1,8 @@
<?php namespace Tests; <?php namespace Tests\Auth;
use BookStack\Auth\Role; use BookStack\Auth\Role;
use BookStack\Auth\User; use BookStack\Auth\User;
use Tests\TestCase;
class Saml2Test extends TestCase class Saml2Test extends TestCase
{ {

View file

@ -1,10 +1,11 @@
<?php namespace Tests; <?php namespace Tests\Auth;
use BookStack\Auth\User; use BookStack\Auth\User;
use DB; use DB;
use Laravel\Socialite\Contracts\Factory; use Laravel\Socialite\Contracts\Factory;
use Laravel\Socialite\Contracts\Provider; use Laravel\Socialite\Contracts\Provider;
use Mockery; use Mockery;
use Tests\TestCase;
class SocialAuthTest extends TestCase class SocialAuthTest extends TestCase
{ {

View file

@ -1,4 +1,4 @@
<?php namespace Tests; <?php namespace Tests\Auth;
use BookStack\Auth\Access\UserInviteService; use BookStack\Auth\Access\UserInviteService;
@ -8,6 +8,7 @@ use Carbon\Carbon;
use DB; use DB;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Notification; use Notification;
use Tests\TestCase;
class UserInviteTest extends TestCase class UserInviteTest extends TestCase
{ {

View file

@ -1,10 +1,11 @@
<?php namespace Tests; <?php namespace Tests\Entity;
use BookStack\Auth\User; use BookStack\Auth\User;
use BookStack\Entities\Book; use BookStack\Entities\Book;
use BookStack\Entities\Bookshelf; use BookStack\Entities\Bookshelf;
use BookStack\Uploads\Image; use BookStack\Uploads\Image;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Tests\TestCase;
use Tests\Uploads\UsesImages; use Tests\Uploads\UsesImages;
class BookShelfTest extends TestCase class BookShelfTest extends TestCase

View file

@ -1,28 +1,35 @@
<?php namespace Tests; <?php namespace Tests\Entity;
class CommentSettingTest extends BrowserKitTest { use BookStack\Entities\Page;
protected $page; use Tests\BrowserKitTest;
public function setUp(): void { class CommentSettingTest extends BrowserKitTest
parent::setUp(); {
$this->page = \BookStack\Entities\Page::first(); protected $page;
}
public function test_comment_disable () { public function setUp(): void
$this->asAdmin(); {
parent::setUp();
$this->page = Page::first();
}
$this->setSettings(['app-disable-comments' => 'true']); public function test_comment_disable()
{
$this->asAdmin();
$this->asAdmin()->visit($this->page->getUrl()) $this->setSettings(['app-disable-comments' => 'true']);
->pageNotHasElement('.comments-list');
}
public function test_comment_enable () { $this->asAdmin()->visit($this->page->getUrl())
$this->asAdmin(); ->pageNotHasElement('.comments-list');
}
$this->setSettings(['app-disable-comments' => 'false']); public function test_comment_enable()
{
$this->asAdmin();
$this->asAdmin()->visit($this->page->getUrl()) $this->setSettings(['app-disable-comments' => 'false']);
->pageHasElement('.comments-list');
} $this->asAdmin()->visit($this->page->getUrl())
->pageHasElement('.comments-list');
}
} }

View file

@ -1,7 +1,8 @@
<?php namespace Tests; <?php namespace Tests\Entity;
use BookStack\Entities\Page; use BookStack\Entities\Page;
use BookStack\Actions\Comment; use BookStack\Actions\Comment;
use Tests\TestCase;
class CommentTest extends TestCase class CommentTest extends TestCase
{ {

View file

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

View file

@ -1,4 +1,4 @@
<?php namespace Tests; <?php namespace Tests\Entity;
use BookStack\Entities\Bookshelf; use BookStack\Entities\Bookshelf;
use BookStack\Entities\Book; use BookStack\Entities\Book;
@ -7,6 +7,7 @@ use BookStack\Entities\Page;
use BookStack\Auth\UserRepo; use BookStack\Auth\UserRepo;
use BookStack\Entities\Repos\PageRepo; use BookStack\Entities\Repos\PageRepo;
use Carbon\Carbon; use Carbon\Carbon;
use Tests\BrowserKitTest;
class EntityTest extends BrowserKitTest class EntityTest extends BrowserKitTest
{ {

View file

@ -1,10 +1,11 @@
<?php namespace Tests; <?php namespace Tests\Entity;
use BookStack\Entities\Chapter; use BookStack\Entities\Chapter;
use BookStack\Entities\Page; use BookStack\Entities\Page;
use BookStack\Uploads\HttpFetcher; use BookStack\Uploads\HttpFetcher;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Tests\TestCase;
class ExportTest extends TestCase class ExportTest extends TestCase
{ {

View file

@ -1,4 +1,6 @@
<?php namespace Tests; <?php namespace Tests\Entity;
use Tests\BrowserKitTest;
class MarkdownTest extends BrowserKitTest class MarkdownTest extends BrowserKitTest
{ {

View file

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

View file

@ -1,6 +1,7 @@
<?php namespace Tests; <?php namespace Tests\Entity;
use BookStack\Entities\Repos\PageRepo; use BookStack\Entities\Repos\PageRepo;
use Tests\BrowserKitTest;
class PageDraftTest extends BrowserKitTest class PageDraftTest extends BrowserKitTest
{ {

View file

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

View file

@ -1,4 +1,4 @@
<?php namespace Entity; <?php namespace Tests\Entity;
use BookStack\Entities\Page; use BookStack\Entities\Page;
use Tests\TestCase; use Tests\TestCase;

View file

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

View file

@ -1,4 +1,4 @@
<?php namespace Tests; <?php namespace Tests\Entity;
use BookStack\Entities\Book; use BookStack\Entities\Book;
use BookStack\Entities\Chapter; use BookStack\Entities\Chapter;
@ -6,6 +6,7 @@ use BookStack\Actions\Tag;
use BookStack\Entities\Entity; use BookStack\Entities\Entity;
use BookStack\Entities\Page; use BookStack\Entities\Page;
use BookStack\Auth\Permissions\PermissionService; use BookStack\Auth\Permissions\PermissionService;
use Tests\BrowserKitTest;
class TagTest extends BrowserKitTest class TagTest extends BrowserKitTest
{ {

View file

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

View file

@ -1,4 +1,4 @@
<?php namespace Tests; <?php namespace Tests\Permissions;
use BookStack\Entities\Bookshelf; use BookStack\Entities\Bookshelf;
use BookStack\Entities\Page; use BookStack\Entities\Page;
@ -6,6 +6,7 @@ use BookStack\Auth\Permissions\PermissionsRepo;
use BookStack\Auth\Role; use BookStack\Auth\Role;
use Laravel\BrowserKitTesting\HttpException; use Laravel\BrowserKitTesting\HttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Tests\BrowserKitTest;
class RolesTest extends BrowserKitTest class RolesTest extends BrowserKitTest
{ {

View file

@ -1,4 +1,6 @@
<?php namespace Tests; <?php namespace Tests\Unit;
use Tests\TestCase;
/** /**
* Class ConfigTest * Class ConfigTest

View file

@ -1,4 +1,6 @@
<?php namespace Tests; <?php namespace Tests\Unit;
use Tests\TestCase;
class UrlTest extends TestCase class UrlTest extends TestCase
{ {

View file

@ -1,8 +1,9 @@
<?php namespace Tests; <?php namespace Tests\Uploads;
use BookStack\Uploads\Attachment; use BookStack\Uploads\Attachment;
use BookStack\Entities\Page; use BookStack\Entities\Page;
use BookStack\Auth\Permissions\PermissionService; use BookStack\Auth\Permissions\PermissionService;
use Tests\TestCase;
class AttachmentTest extends TestCase class AttachmentTest extends TestCase
{ {

View file

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

View file

@ -1,4 +1,4 @@
<?php namespace Test; <?php namespace Test\User;
use BookStack\Api\ApiToken; use BookStack\Api\ApiToken;
use Carbon\Carbon; use Carbon\Carbon;

View file

@ -1,4 +1,6 @@
<?php namespace Tests; <?php namespace Test\User;
use Tests\TestCase;
class UserPreferencesTest extends TestCase class UserPreferencesTest extends TestCase
{ {

View file

@ -1,4 +1,6 @@
<?php namespace Tests; <?php namespace Test\User;
use Tests\BrowserKitTest;
class UserProfileTest extends BrowserKitTest class UserProfileTest extends BrowserKitTest
{ {