From 47a107ac5b27c41a0b1ef6cc0f13a39cc0e5ceee Mon Sep 17 00:00:00 2001
From: Adam Brown ' . implode('
+
@@ -55,4 +65,4 @@
Обратите внимание, что пользователи смогут изменить свои адреса уже после регистрации.',
'reg_confirm_restrict_domain_placeholder' => 'Без ограничений',
From f311635de6589307abd2707fad4c38245eab7947 Mon Sep 17 00:00:00 2001
From: Dan Brown
Büyük görseller ölçeklenecektir.',
+ 'app_primary_color' => 'Uygulamanın Birincil Rengi',
+ 'app_primary_color_desc' => 'Bu bir hex değeri olmalıdır.
Varsayılan rengi seçmek için boş bırakın.',
+ 'app_homepage' => 'Uygulama Anasayfası',
+ 'app_homepage_desc' => 'Anasayfada görünmesi için bir view seçin. Sayfa izinleri seçili sayfalar için yok sayılacaktır.',
+ 'app_homepage_select' => 'Sayfa seçiniz',
+ 'app_disable_comments' => 'Yorumları Engelle',
+ 'app_disable_comments_toggle' => 'Yorumları engelle',
+ 'app_disable_comments_desc' => 'Yorumları uygulamadaki bütün sayfalar için engelle.
Mevcut yorumlar gösterilmeyecektir.',
+
+ // Registration Settings
+ 'reg_settings' => 'Kayıt',
+ 'reg_enable' => 'Kaydolmaya İzin Ver',
+ 'reg_enable_toggle' => 'Kaydolmaya izin ver',
+ 'reg_enable_desc' => 'Kayıt olmaya izin verdiğinizde kullanıcılar kendilerini uygulamaya kaydedebilecekler. Kayıt olduktan sonra kendilerine varsayılan kullanıcı rolü atanacaktır.',
+ 'reg_default_role' => 'Kayıt olduktan sonra varsayılan kullanıcı rolü',
+ 'reg_email_confirmation' => 'Email Doğrulama',
+ 'reg_email_confirmation_toggle' => 'E-mail onayı gerektir',
+ 'reg_confirm_email_desc' => 'Eğer domain kısıtlaması kullanılıyorsa o zaman email doğrulaması gereklidir ve bu seçenek yok sayılacaktır.',
+ 'reg_confirm_restrict_domain' => 'Domain Kısıtlaması',
+ 'reg_confirm_restrict_domain_desc' => 'Kısıtlamak istediğiniz email domainlerini vigül ile ayırarak yazınız. Kullanıcılara uygulamaya erişmeden önce adreslerini doğrulamak için bir mail gönderilecektir.
Kullanıcılar başarıyla kaydolduktan sonra email adreslerini değiştiremeyeceklerdir.',
+ 'reg_confirm_restrict_domain_placeholder' => 'Hiçbir kısıtlama tanımlanmamış',
+
+ // Maintenance settings
+ 'maint' => 'Bakım',
+ 'maint_image_cleanup' => 'Görsel Temizliği',
+ 'maint_image_cleanup_desc' => "Sayfaları ve revizyon içeriklerini tarayarak hangi gösel ve çizimlerin kullanımda olduğunu ve hangilerinin gereksiz olduğunu tespit eder. Bunu başlatmadan veritabanı ve görsellerin tam bir yedeğinin alındığından emin olun.",
+ 'maint_image_cleanup_ignore_revisions' => 'Revizyonlardaki görselleri yoksay',
+ 'maint_image_cleanup_run' => 'Temizliği Başlat',
+ 'maint_image_cleanup_warning' => ':count potansiyel kullanılmayan görsel bulundu. Bu görselleri silmek istediğinizden emin misiniz?',
+ 'maint_image_cleanup_success' => ':count potanisyel kullanılmayan görsel bulundu ve silindi!',
+ 'maint_image_cleanup_nothing_found' => 'Kullanılmayan görsel bulunamadı ve birşey silinmedi!',
+
+ // Role Settings
+ 'roles' => 'Roller',
+ 'role_user_roles' => 'Kullanıcı Rolleri',
+ 'role_create' => 'Yeni Rol Oluştur',
+ 'role_create_success' => 'Rol Başarıyla Oluşturuldu',
+ 'role_delete' => 'Rolü Sil',
+ 'role_delete_confirm' => 'Bu işlem \':roleName\' rolünü silecektir.',
+ 'role_delete_users_assigned' => 'Bu role atanmış :userCount adet kullanıcı var. Eğer bu kullanıcıların rollerini değiştirmek istiyorsanız aşağıdan yeni bir rol seçin.',
+ 'role_delete_no_migration' => "Kullanıcıları taşıma",
+ 'role_delete_sure' => 'Bu rolü silmek istediğinizden emin misiniz?',
+ 'role_delete_success' => 'Rol başarıyla silindi',
+ 'role_edit' => 'Rolü Düzenle',
+ 'role_details' => 'Rol Detayları',
+ 'role_name' => 'Rol Adı',
+ 'role_desc' => 'Rolün Kısa Tanımı',
+ 'role_external_auth_id' => 'Harici Authentication ID\'leri',
+ 'role_system' => 'Sistem Yetkileri',
+ 'role_manage_users' => 'Kullanıcıları yönet',
+ 'role_manage_roles' => 'Rolleri ve rol izinlerini yönet',
+ 'role_manage_entity_permissions' => 'Bütün kitap, bölüm ve sayfa izinlerini yönet',
+ 'role_manage_own_entity_permissions' => 'Sahip olunan kitap, bölüm ve sayfaların izinlerini yönet',
+ 'role_manage_settings' => 'Uygulama ayarlarını yönet',
+ 'role_asset' => 'Asset Yetkileri',
+ 'role_asset_desc' => 'Bu izinleri assetlere sistem içinden varsayılan erişimi kontrol eder. Kitaplar, bölümler ve sayfaların izinleri bu izinleri override eder.',
+ 'role_asset_admins' => 'Yöneticilere otomatik olarak bütün içeriğe erişim yetkisi verilir fakat bu opsiyonlar UI özelliklerini gösterir veya gizler.',
+ 'role_all' => 'Hepsi',
+ 'role_own' => 'Sahip Olunan',
+ 'role_controlled_by_asset' => 'Yükledikleri asset tarafından kontrol ediliyor',
+ 'role_save' => 'Rolü Kaydet',
+ 'role_update_success' => 'Rol başarıyla güncellendi',
+ 'role_users' => 'Bu roldeki kullanıcılar',
+ 'role_users_none' => 'Bu role henüz bir kullanıcı atanmadı',
+
+ // Users
+ 'users' => 'Kullanıcılar',
+ 'user_profile' => 'Kullanıcı Profili',
+ 'users_add_new' => 'Yeni Kullanıcı Ekle',
+ 'users_search' => 'Kullanıcıları Ara',
+ 'users_details' => 'Kullanıcı Detayları',
+ 'users_details_desc' => 'Bu kullanıcı için gösterilecek bir isim ve mail adresi belirleyin. Bu e-mail adresi kullanıcı tarafından giriş yaparken kullanılacak.',
+ 'users_details_desc_no_email' => 'Diğer kullanıcılar tarafından tanınabilmesi için bir isim belirleyin.',
+ 'users_role' => 'Kullanıcı Rolleri',
+ 'users_role_desc' => 'Bu kullanıcının hangi rollere atanabileceğini belirleyin. Eğer bir kullanıcıya birden fazla rol atanırsa, kullanıcı bütün rollerin özelliklerini kullanabilir.',
+ 'users_password' => 'Kullanıcı Parolası',
+ 'users_password_desc' => 'Kullanıcının giriş yaparken kullanacağı bir parola belirleyin. Parola en az 5 karakter olmalıdır.',
+ 'users_external_auth_id' => 'Harici Authentication ID\'si',
+ 'users_external_auth_id_desc' => 'Bu ID kullanıcı LDAP sunucu ile bağlantı kurarken kullanılır.',
+ 'users_password_warning' => 'Sadece parolanızı değiştirmek istiyorsanız aşağıyı doldurunuz.',
+ 'users_system_public' => 'Bu kullanıcı sizin uygulamanızı ziyaret eden bütün misafir kullanıcıları temsil eder. Giriş yapmak için kullanılamaz, otomatik olarak atanır.',
+ 'users_delete' => 'Kullanıcı Sil',
+ 'users_delete_named' => ':userName kullanıcısını sil ',
+ 'users_delete_warning' => 'Bu işlem \':userName\' kullanıcısını sistemden tamamen silecektir.',
+ 'users_delete_confirm' => 'Bu kullanıcıyı tamamen silmek istediğinize emin misiniz?',
+ 'users_delete_success' => 'Kullanıcılar başarıyla silindi.',
+ 'users_edit' => 'Kullanıcıyı Güncelle',
+ 'users_edit_profile' => 'Profili Düzenle',
+ 'users_edit_success' => 'Kullanıcı başarıyla güncellendi',
+ 'users_avatar' => 'Kullanıcı Avatarı',
+ 'users_avatar_desc' => 'Bu kullanıcıyı temsil eden bir görsel seçin. Yaklaşık 256px kare olmalıdır.',
+ 'users_preferred_language' => 'Tercih Edilen Dil',
+ 'users_preferred_language_desc' => 'Bu seçenek kullanıcı arayüzünün dilini değiştirecektir. Herhangi bir kullanıcı içeriğini etkilemeyecektir.',
+ 'users_social_accounts' => 'Sosyal Hesaplar',
+ 'users_social_accounts_info' => 'Burada diğer hesaplarınızı ekleyerek daha hızlı ve kolay giriş sağlayabilirsiniz. Bir hesabın bağlantısını kesmek daha önce edilnilen erişiminizi kaldırmaz. Profil ayarlarınızdan bağlı sosyal hesabınızın erişimini kaldırınız.',
+ 'users_social_connect' => 'Hesap Bağla',
+ 'users_social_disconnect' => 'Hesabın Bağlantısını Kes',
+ 'users_social_connected' => ':socialAccount hesabı profilinize başarıyla bağlandı.',
+ 'users_social_disconnected' => ':socialAccount hesabınızın profilinizle ilişiği başarıyla kesildi.',
+];
diff --git a/resources/lang/tr/validation.php b/resources/lang/tr/validation.php
new file mode 100644
index 000000000..e7683a024
--- /dev/null
+++ b/resources/lang/tr/validation.php
@@ -0,0 +1,85 @@
+ ':attribute kabul edilmelidir.',
+ 'active_url' => ':attribute geçerli bir URL adresi değildir.',
+ 'after' => ':attribute :date tarihinden sonra bir tarih olmalıdır.',
+ 'alpha' => ':attribute sadece harflerden oluşabilir.',
+ 'alpha_dash' => ':attribute sadece harf, rakam ve tirelerden oluşabilir.',
+ 'alpha_num' => ':attribute sadece harf ve rakam oluşabilir.',
+ 'array' => ':attribute array olmalıdır..',
+ 'before' => ':attribute :date tarihinden önce bir tarih olmalıdır.',
+ 'between' => [
+ 'numeric' => ':attribute, :min ve :max değerleri arasında olmalıdır.',
+ 'file' => ':attribute, :min ve :max kilobyte boyutları arasında olmalıdır.',
+ 'string' => ':attribute, :min ve :max karakter arasında olmalıdır.',
+ 'array' => ':attribute :min ve :max öge arasında olmalıdır.',
+ ],
+ 'boolean' => ':attribute true veya false olmalıdır.',
+ 'confirmed' => ':attribute doğrulaması eşleşmiyor.',
+ 'date' => ':attribute geçerli bir tarih değil.',
+ 'date_format' => ':attribute formatı :format\'ına uymuyor.',
+ 'different' => ':attribute be :other birbirinden farklı olmalıdır.',
+ 'digits' => ':attribute :digits basamaklı olmalıdır.',
+ 'digits_between' => ':attribute :min ve :max basamaklı olmalıdır.',
+ 'email' => ':attribute geçerli bir e-mail adresi olmalıdır.',
+ 'filled' => ':attribute gerekli bir alandır.',
+ 'exists' => 'Seçilen :attribute geçerli bir alan değildir.',
+ 'image' => ':attribute bir görsel olmalıdır.',
+ 'image_extension' => ':attribute geçerli ve desteklenen bir görsel uzantısı değildir.',
+ 'in' => 'Seçilen :attribute geçerli değildir.',
+ 'integer' => ':attribute bir integer değeri olmalıdır.',
+ 'ip' => ':attribute geçerli bir IP adresi olmalıdır.',
+ 'max' => [
+ 'numeric' => ':attribute, :max değerinden büyük olmamalıdır.',
+ 'file' => ':attribute, :max kilobyte boyutundan büyük olmamalıdır.',
+ 'string' => ':attribute, :max karakter boyutundan büyük olmamalıdır.',
+ 'array' => ':attribute, en fazla :max öge içermelidir.',
+ ],
+ 'mimes' => ':attribute :values dosya tipinde olmalıdır.',
+ 'min' => [
+ 'numeric' => ':attribute, :min değerinden az olmamalıdır.',
+ 'file' => ':attribute, :min kilobyte boyutundan küçük olmamalıdır.',
+ 'string' => ':attribute, :min karakter boyutundan küçük olmamalıdır.',
+ 'array' => ':attribute, en az :min öge içermelidir.',
+ ],
+ 'no_double_extension' => ':attribute sadece tek bir dosya tipinde olmalıdır.',
+ 'not_in' => 'Seçili :attribute geçerli değildir.',
+ 'numeric' => ':attribute rakam olmalıdır.',
+ 'regex' => ':attribute formatı geçerli değildir.',
+ 'required' => 'The :attribute field is required. :attribute alanı gereklidir.',
+ 'required_if' => ':other alanı :value değerinde ise :attribute alanı gereklidir.',
+ 'required_with' => 'Eğer :values değeri geçerli ise :attribute alanı gereklidir.',
+ 'required_with_all' => 'Eğer :values değeri geçerli ise :attribute alanı gereklidir. ',
+ 'required_without' => 'Eğer :values değeri geçerli değil ise :attribute alanı gereklidir.',
+ 'required_without_all' => 'Eğer :values değerlerinden hiçbiri geçerli değil ise :attribute alanı gereklidir.',
+ 'same' => ':attribute ve :other eşleşmelidir.',
+ 'size' => [
+ 'numeric' => ':attribute, :size boyutunda olmalıdır.',
+ 'file' => ':attribute, :size kilobyte boyutunda olmalıdır.',
+ 'string' => ':attribute, :size karakter uzunluğunda olmalıdır.',
+ 'array' => ':attribute, :size sayıda öge içermelidir.',
+ ],
+ 'string' => ':attribute string olmalıdır.',
+ 'timezone' => ':attribute geçerli bir alan olmalıdır.',
+ 'unique' => ':attribute daha önce alınmış.',
+ 'url' => ':attribute formatı geçerli değil.',
+ 'uploaded' => 'Dosya yüklemesi başarısız oldu. Server bu boyutta dosyaları kabul etmiyor olabilir.',
+
+ // Custom validation lines
+ 'custom' => [
+ 'password-confirm' => [
+ 'required_with' => 'Parola onayı gereklidir.',
+ ],
+ ],
+
+ // Custom validation attributes
+ 'attributes' => [],
+];
From 140298bd96778ded6af37401b83112256ac750bf Mon Sep 17 00:00:00 2001
From: Dan Brown
test message content
'; - $this->asAdmin()->visit($this->page->getUrl() . '/edit') + $this->asAdmin()->visit($this->page->getUrl('/edit')) ->dontSeeInField('html', $addedContent); $newContent = $this->page->html . $addedContent; $this->pageRepo->updatePageDraft($this->page, ['html' => $newContent]); - $this->asAdmin()->visit($this->page->getUrl() . '/edit') + $this->asAdmin()->visit($this->page->getUrl('/edit')) ->seeInField('html', $newContent); } public function test_draft_not_visible_by_others() { $addedContent = 'test message content
'; - $this->asAdmin()->visit($this->page->getUrl() . '/edit') + $this->asAdmin()->visit($this->page->getUrl('/edit')) ->dontSeeInField('html', $addedContent); $newContent = $this->page->html . $addedContent; $newUser = $this->getEditor(); $this->pageRepo->updatePageDraft($this->page, ['html' => $newContent]); - $this->actingAs($newUser)->visit($this->page->getUrl() . '/edit') + + $this->actingAs($newUser)->visit($this->page->getUrl('/edit')) ->dontSeeInField('html', $newContent); } @@ -44,7 +45,7 @@ class PageDraftTest extends BrowserKitTest { $this->asAdmin(); $this->pageRepo->updatePageDraft($this->page, ['html' => 'test content']); - $this->asAdmin()->visit($this->page->getUrl() . '/edit') + $this->asAdmin()->visit($this->page->getUrl('/edit')) ->see('You are currently editing a draft'); } @@ -52,7 +53,7 @@ class PageDraftTest extends BrowserKitTest { $nonEditedPage = \BookStack\Entities\Page::take(10)->get()->last(); $addedContent = 'test message content
'; - $this->asAdmin()->visit($this->page->getUrl() . '/edit') + $this->asAdmin()->visit($this->page->getUrl('/edit')) ->dontSeeInField('html', $addedContent); $newContent = $this->page->html . $addedContent; @@ -60,7 +61,7 @@ class PageDraftTest extends BrowserKitTest $this->pageRepo->updatePageDraft($this->page, ['html' => $newContent]); $this->actingAs($newUser) - ->visit($this->page->getUrl() . '/edit') + ->visit($this->page->getUrl('/edit')) ->see('Admin has started editing this page'); $this->flushSession(); $this->visit($nonEditedPage->getUrl() . '/edit') diff --git a/tests/Entity/TagTest.php b/tests/Entity/TagTest.php index 70b8c960b..13876410a 100644 --- a/tests/Entity/TagTest.php +++ b/tests/Entity/TagTest.php @@ -3,6 +3,7 @@ use BookStack\Entities\Book; use BookStack\Entities\Chapter; use BookStack\Actions\Tag; +use BookStack\Entities\Entity; use BookStack\Entities\Page; use BookStack\Auth\Permissions\PermissionService; @@ -14,9 +15,9 @@ class TagTest extends BrowserKitTest /** * Get an instance of a page that has many tags. * @param \BookStack\Actions\Tag[]|bool $tags - * @return mixed + * @return Entity */ - protected function getEntityWithTags($class, $tags = false) + protected function getEntityWithTags($class, $tags = false): Entity { $entity = $class::first(); @@ -122,7 +123,7 @@ class TagTest extends BrowserKitTest // Set restricted permission the page $page->restricted = true; $page->save(); - $permissionService->buildJointPermissionsForEntity($page); + $page->rebuildPermissions(); $this->asAdmin()->get('/ajax/tags/suggest/names?search=co')->seeJsonEquals(['color', 'country']); $this->asEditor()->get('/ajax/tags/suggest/names?search=co')->seeJsonEquals([]); diff --git a/tests/SharedTestHelpers.php b/tests/SharedTestHelpers.php index ed92fa59f..2bff27223 100644 --- a/tests/SharedTestHelpers.php +++ b/tests/SharedTestHelpers.php @@ -80,7 +80,7 @@ trait SharedTestHelpers */ protected function regenEntityPermissions(Entity $entity) { - app(PermissionService::class)->buildJointPermissionsForEntity($entity); + $entity->rebuildPermissions(); $entity->load('jointPermissions'); } From 7cd956b24b7a08a8b274d9f244bf6ab482de9635 Mon Sep 17 00:00:00 2001 From: Dan Brown{{ $bookChild->text }}
+{{ $bookChild->description }}
@if(count($bookChild->pages) > 0) @foreach($bookChild->pages as $page) diff --git a/resources/views/errors/404.blade.php b/resources/views/errors/404.blade.php index c1937ff23..9c599307e 100644 --- a/resources/views/errors/404.blade.php +++ b/resources/views/errors/404.blade.php @@ -22,7 +22,7 @@{!! nl2br(e($shelf->description)) !!}
- @if(count($books) > 0) + @if(count($shelf->visibleBooks) > 0)new content
', 'summary' => 'page revision testing']); + $pageRepo->update($page, ['name' => 'updated page', 'html' => 'new content
', 'summary' => 'page revision testing']); $pageRepo->updatePageDraft($page, ['name' => 'updated page', 'html' => 'new content in draft
', 'summary' => 'page revision testing']); $this->assertDatabaseHas('page_revisions', [ diff --git a/tests/Entity/EntityTest.php b/tests/Entity/EntityTest.php index a3fb1cfe1..b506da2aa 100644 --- a/tests/Entity/EntityTest.php +++ b/tests/Entity/EntityTest.php @@ -3,7 +3,6 @@ use BookStack\Entities\Book; use BookStack\Entities\Chapter; use BookStack\Entities\Page; -use BookStack\Entities\Repos\EntityRepo; use BookStack\Auth\UserRepo; use BookStack\Entities\Repos\PageRepo; use Carbon\Carbon; @@ -192,7 +191,7 @@ class EntityTest extends BrowserKitTest $entities = $this->createEntityChainBelongingToUser($creator, $updater); $this->actingAs($creator); app(UserRepo::class)->destroy($creator); - app(PageRepo::class)->savePageRevision($entities['page']); + app(PageRepo::class)->update($entities['page'], ['html' => 'hello!
>']); $this->checkEntitiesViewable($entities); } @@ -205,7 +204,7 @@ class EntityTest extends BrowserKitTest $entities = $this->createEntityChainBelongingToUser($creator, $updater); $this->actingAs($updater); app(UserRepo::class)->destroy($updater); - app(PageRepo::class)->savePageRevision($entities['page']); + app(PageRepo::class)->update($entities['page'], ['html' => 'Hello there!
']); $this->checkEntitiesViewable($entities); } @@ -273,8 +272,7 @@ class EntityTest extends BrowserKitTest public function test_slug_multi_byte_lower_casing() { - $entityRepo = app(EntityRepo::class); - $book = $entityRepo->createFromInput('book', [ + $book = $this->newBook([ 'name' => 'КНИГА' ]); @@ -284,8 +282,7 @@ class EntityTest extends BrowserKitTest public function test_slug_format() { - $entityRepo = app(EntityRepo::class); - $book = $entityRepo->createFromInput('book', [ + $book = $this->newBook([ 'name' => 'PartA / PartB / PartC' ]); diff --git a/tests/Entity/PageContentTest.php b/tests/Entity/PageContentTest.php index a0fcb5ca8..8a78c8ac0 100644 --- a/tests/Entity/PageContentTest.php +++ b/tests/Entity/PageContentTest.php @@ -1,8 +1,7 @@ id)->first(); $this->assertEquals(substr_count($updatedPage->html, "bkmrk-test\""), 1); } + + public function test_get_page_nav_sets_correct_properties() + { + $content = 'new content
', 'summary' => 'page revision testing']); + $pageRepo->update($page, ['name' => 'updated page', 'html' => 'new content
', 'summary' => 'page revision testing']); $pageRevision = $page->revisions->last(); $revisionView = $this->get($page->getUrl() . '/revisions/' . $pageRevision->id); @@ -30,8 +30,8 @@ class PageRevisionTest extends TestCase $pageRepo = app(PageRepo::class); $page = Page::first(); - $pageRepo->updatePage($page, $page->book_id, ['name' => 'updated page abc123', 'html' => 'new contente def456
', 'summary' => 'initial page revision testing']); - $pageRepo->updatePage($page, $page->book_id, ['name' => 'updated page again', 'html' => 'new content
', 'summary' => 'page revision testing']); + $pageRepo->update($page, ['name' => 'updated page abc123', 'html' => 'new contente def456
', 'summary' => 'initial page revision testing']); + $pageRepo->update($page, ['name' => 'updated page again', 'html' => 'new content
', 'summary' => 'page revision testing']); $page = Page::find($page->id); @@ -98,7 +98,7 @@ class PageRevisionTest extends TestCase $beforeRevisionCount = $page->revisions->count(); $currentRevision = $page->getCurrentRevision(); $resp = $this->asEditor()->delete($currentRevision->getUrl('/delete/')); - $resp->assertStatus(400); + $resp->assertRedirect($page->getUrl('/revisions')); $page = Page::find($page->id); $afterRevisionCount = $page->revisions->count(); diff --git a/tests/Entity/SortTest.php b/tests/Entity/SortTest.php index cad6d3c01..3c83d626a 100644 --- a/tests/Entity/SortTest.php +++ b/tests/Entity/SortTest.php @@ -1,6 +1,5 @@ asAdmin(); $pageRepo = app(PageRepo::class); - $draft = $pageRepo->getDraftPage($this->book); + $draft = $pageRepo->getNewDraftPage($this->book); $resp = $this->get($this->book->getUrl()); $resp->assertSee($draft->name); @@ -214,7 +213,6 @@ class SortTest extends TestCase 'entity_selection' => 'book:' . $newBook->id, 'name' => 'My copied test page' ]); - $pageCopy = Page::where('name', '=', 'My copied test page')->first(); $movePageResp->assertRedirect($pageCopy->getUrl()); diff --git a/tests/Permissions/RestrictionsTest.php b/tests/Permissions/RestrictionsTest.php index f6e07c0f1..d899c6396 100644 --- a/tests/Permissions/RestrictionsTest.php +++ b/tests/Permissions/RestrictionsTest.php @@ -5,14 +5,13 @@ use BookStack\Entities\Bookshelf; use BookStack\Entities\Chapter; use BookStack\Entities\Entity; use BookStack\Auth\User; -use BookStack\Entities\Repos\EntityRepo; use BookStack\Entities\Page; class RestrictionsTest extends BrowserKitTest { /** - * @var \BookStack\Auth\User + * @var User */ protected $user; @@ -327,7 +326,7 @@ class RestrictionsTest extends BrowserKitTest public function test_page_view_restriction() { - $page = \BookStack\Entities\Page::first(); + $page = Page::first(); $pageUrl = $page->getUrl(); $this->actingAs($this->user) @@ -367,7 +366,7 @@ class RestrictionsTest extends BrowserKitTest public function test_page_delete_restriction() { - $page = \BookStack\Entities\Page::first(); + $page = Page::first(); $pageUrl = $page->getUrl(); $this->actingAs($this->user) @@ -438,7 +437,7 @@ class RestrictionsTest extends BrowserKitTest public function test_page_restriction_form() { - $page = \BookStack\Entities\Page::first(); + $page = Page::first(); $this->asAdmin()->visit($page->getUrl() . '/permissions') ->see('Page Permissions') ->check('restricted') @@ -665,10 +664,8 @@ class RestrictionsTest extends BrowserKitTest $this->setEntityRestrictions($firstBook, ['view', 'update']); $this->setEntityRestrictions($secondBook, ['view']); - $firstBookChapter = $this->app[EntityRepo::class]->createFromInput('chapter', - ['name' => 'first book chapter'], $firstBook); - $secondBookChapter = $this->app[EntityRepo::class]->createFromInput('chapter', - ['name' => 'second book chapter'], $secondBook); + $firstBookChapter = $this->newChapter(['name' => 'first book chapter'], $firstBook); + $secondBookChapter = $this->newChapter(['name' => 'second book chapter'], $secondBook); // Create request data $reqData = [ diff --git a/tests/SharedTestHelpers.php b/tests/SharedTestHelpers.php index 358bf6ee3..3433f3b83 100644 --- a/tests/SharedTestHelpers.php +++ b/tests/SharedTestHelpers.php @@ -1,9 +1,14 @@ users()->first(); + $user = Role::getRole('viewer')->users()->first(); if (!empty($attributes)) $user->forceFill($attributes)->save(); return $user; } @@ -76,7 +83,7 @@ trait SharedTestHelpers /** * Regenerate the permission for an entity. * @param Entity $entity - * @throws \Throwable + * @throws Throwable */ protected function regenEntityPermissions(Entity $entity) { @@ -87,10 +94,10 @@ trait SharedTestHelpers /** * Create and return a new bookshelf. * @param array $input - * @return \BookStack\Entities\Bookshelf + * @return Bookshelf */ public function newShelf($input = ['name' => 'test shelf', 'description' => 'My new test shelf']) { - return app(EntityRepo::class)->createFromInput('bookshelf', $input); + return app(BookshelfRepo::class)->create($input, []); } /** @@ -99,30 +106,30 @@ trait SharedTestHelpers * @return Book */ public function newBook($input = ['name' => 'test book', 'description' => 'My new test book']) { - return app(EntityRepo::class)->createFromInput('book', $input); + return app(BookRepo::class)->create($input); } /** * Create and return a new test chapter * @param array $input * @param Book $book - * @return \BookStack\Entities\Chapter + * @return Chapter */ public function newChapter($input = ['name' => 'test chapter', 'description' => 'My new test chapter'], Book $book) { - return app(EntityRepo::class)->createFromInput('chapter', $input, $book); + return app(ChapterRepo::class)->create($input, $book); } /** * Create and return a new test page * @param array $input * @return Page - * @throws \Throwable + * @throws Throwable */ public function newPage($input = ['name' => 'test page', 'html' => 'My new test page']) { $book = Book::first(); $pageRepo = app(PageRepo::class); - $draftPage = $pageRepo->getDraftPage($book); - return $pageRepo->publishPageDraft($draftPage, $input); + $draftPage = $pageRepo->getNewDraftPage($book); + return $pageRepo->publishDraft($draftPage, $input); } /** @@ -167,10 +174,10 @@ trait SharedTestHelpers /** * Give the given user some permissions. - * @param \BookStack\Auth\User $user + * @param User $user * @param array $permissions */ - protected function giveUserPermissions(\BookStack\Auth\User $user, $permissions = []) + protected function giveUserPermissions(User $user, $permissions = []) { $newRole = $this->createNewRole($permissions); $user->attachRole($newRole); @@ -198,7 +205,7 @@ trait SharedTestHelpers */ protected function mockHttpFetch($returnData, int $times = 1) { - $mockHttp = \Mockery::mock(HttpFetcher::class); + $mockHttp = Mockery::mock(HttpFetcher::class); $this->app[HttpFetcher::class] = $mockHttp; $mockHttp->shouldReceive('fetch') ->times($times) diff --git a/tests/Unit/PageRepoTest.php b/tests/Unit/PageRepoTest.php deleted file mode 100644 index 38ffbf616..000000000 --- a/tests/Unit/PageRepoTest.php +++ /dev/null @@ -1,78 +0,0 @@ -pageRepo = app()->make(PageRepo::class); - } - - public function test_get_page_nav_sets_correct_properties() - { - $content = 'Hello
", 'summary' => '' From ccec991f6c562514e50d081736253ed9fd7b93ae Mon Sep 17 00:00:00 2001 From: Dan Brown{{ trans('settings.maint_send_test_email_desc') }}
+