Skip to content

NOW MANAGED ON CODEBERG

Fixed chapter breadcrumbs and testing issues

Dan Brown82e2c523e6ad
diff --git a/composer.json b/composer.json
index 396a9babd..2381c534b 100644
--- a/composer.json
+++ b/composer.json
@@ -64,6 +64,10 @@
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
+ ],
+ "refresh-test-database": [
+ "php artisan migrate:refresh --database=mysql_testing",
+ "php artisan db:seed --class=DummyContentSeeder --database=mysql_testing"
]
},
"config": {
diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php
index 43e214386..ebf78d1fa 100644
--- a/database/factories/ModelFactory.php
+++ b/database/factories/ModelFactory.php
@@ -43,7 +43,8 @@ $factory->define(BookStack\Page::class, function ($faker) {
'name' => $faker->sentence,
'slug' => str_random(10),
'html' => $html,
- 'text' => strip_tags($html)
+ 'text' => strip_tags($html),
+ 'revision_count' => 1
];
});
diff --git a/resources/views/chapters/_breadcrumbs.blade.php b/resources/views/chapters/_breadcrumbs.blade.php
index 1e090759a..418168461 100644
--- a/resources/views/chapters/_breadcrumbs.blade.php
+++ b/resources/views/chapters/_breadcrumbs.blade.php
@@ -1,5 +1,5 @@
<div class="breadcrumbs">
- @if (userCan('view', $book))
+ @if (userCan('view', $chapter->book))
<a href="{{ $chapter->book->getUrl() }}" class="text-book text-button"><i class="zmdi zmdi-book"></i>{{ $chapter->book->getShortName() }}</a>
<span class="sep">&raquo;</span>
@endif
diff --git a/tests/BrowserKitTest.php b/tests/BrowserKitTest.php
index 8e02cb5f1..62fa4a190 100644
--- a/tests/BrowserKitTest.php
+++ b/tests/BrowserKitTest.php
@@ -22,6 +22,12 @@ abstract class BrowserKitTest extends TestCase
private $admin;
private $editor;
+ public function tearDown()
+ {
+ \DB::disconnect('mysql_testing');
+ parent::tearDown();
+ }
+
/**
* Creates the application.
*