]> BookStack Code Mirror - bookstack/commitdiff
Merge branch 'master' into docker-tests
authorDan Brown <redacted>
Sun, 21 Mar 2021 16:49:22 +0000 (16:49 +0000)
committerDan Brown <redacted>
Sun, 21 Mar 2021 16:49:22 +0000 (16:49 +0000)
app/Config/database.php
dev/docker/entrypoint.app.sh
dev/docker/init.db/01.sql [new file with mode: 0644]
docker-compose.yml
readme.md

index ed654ffb9172b4789a62c922d971adb8f550976d..6e7cf529cf7527133c1ebd0d832addac0b68fe65 100644 (file)
@@ -81,10 +81,11 @@ return [
         'mysql_testing' => [
             'driver'    => 'mysql',
             'url' => env('TEST_DATABASE_URL'),
-            'host'      => '127.0.0.1',
+            'host'      => $mysql_host,
             'database'  => 'bookstack-test',
             'username'  => env('MYSQL_USER', 'bookstack-test'),
             'password'  => env('MYSQL_PASSWORD', 'bookstack-test'),
+            'port'      => $mysql_port,
             'charset'   => 'utf8mb4',
             'collation' => 'utf8mb4_unicode_ci',
             'prefix'    => '',
index e91d34a713377a7e579a6594000c01fb5c98ba57..9709139ab4a9606c660bc4ea3d7509f154b67364 100755 (executable)
@@ -10,6 +10,7 @@ else
     composer install
     wait-for-it db:3306 -t 45
     php artisan migrate --database=mysql
+    php artisan migrate --database=mysql_testing
     chown -R www-data:www-data storage
     exec apache2-foreground
 fi
diff --git a/dev/docker/init.db/01.sql b/dev/docker/init.db/01.sql
new file mode 100644 (file)
index 0000000..2536c3f
--- /dev/null
@@ -0,0 +1,5 @@
+# create test database
+CREATE DATABASE IF NOT EXISTS `bookstack-test`;
+
+# grant rights
+GRANT ALL PRIVILEGES ON `bookstack-test`.* TO 'bookstack-test'@'%';
index 39f5bdc18d11a997b5bfd71905ff1704966207a4..037c5f67eb5baf14bd5c764cf6b9592335786445 100644 (file)
@@ -10,12 +10,13 @@ services:
   db:
     image: mysql:8
     environment:
-      MYSQL_DATABASE: bookstack-test
+      MYSQL_DATABASE: bookstack-dev
       MYSQL_USER: bookstack-test
       MYSQL_PASSWORD: bookstack-test
       MYSQL_RANDOM_ROOT_PASSWORD: 'true'
     command: --default-authentication-plugin=mysql_native_password
     volumes:
+      - ./dev/docker/init.db:/docker-entrypoint-initdb.d
       - db:/var/lib/mysql
   app:
     build:
@@ -25,7 +26,7 @@ services:
       DB_CONNECTION: mysql
       DB_HOST: db
       DB_PORT: 3306
-      DB_DATABASE: bookstack-test
+      DB_DATABASE: bookstack-dev
       DB_USERNAME: bookstack-test
       DB_PASSWORD: bookstack-test
       MAIL_DRIVER: smtp
index a19341ce4e95dd7769871a137167e9fc90068ec1..a039b108cb86c46a5d6d5da93c5e1cf63f9c426d 100644 (file)
--- a/readme.md
+++ b/readme.md
@@ -42,7 +42,7 @@ Below is a high-level road map view for BookStack to provide a sense of directio
 
 BookStack releases are each assigned a version number, such as "v0.25.2", in the format `v<phase>.<feature>.<patch>`. A change only in the `patch` number indicates a fairly minor release that mainly contains fixes and therefore is very unlikely to cause breakages upon update. A change in the `feature` number indicates a release which will generally bring new features in addition to fixes and enhancements. These releases have a small chance of introducing breaking changes upon update so it's worth checking for any notes in the [update guide](https://www.bookstackapp.com/docs/admin/updates/). A change in the `phase` indicates a much large change in BookStack that will likely incur breakages requiring manual intervention.
 
-Each BookStack release will have a [milestone](https://github.com/BookStackApp/BookStack/milestones) created with issues & pull requests assigned to it to define what will be in that release. Milestones are built up then worked through until complete at which point, after some testing and documentation updates, the release will be deployed. 
+Each BookStack release will have a [milestone](https://github.com/BookStackApp/BookStack/milestones) created with issues & pull requests assigned to it to define what will be in that release. Milestones are built up then worked through until complete at which point, after some testing and documentation updates, the release will be deployed.
 
 For feature releases, and some patch releases, the release will be accompanied by a post on the [BookStack blog](https://www.bookstackapp.com/blog/) which will provide additional detail on features, changes & updates otherwise the [GitHub release page](https://github.com/BookStackApp/BookStack/releases) will show a list of changes. You can sign up to be alerted to new BookStack blogs posts (once per week maximum) [at this link](https://updates.bookstackapp.com/signup/bookstack-news-and-updates).
 
@@ -102,12 +102,24 @@ If all the conditions are met, you can proceed with the following steps:
 
 If needed, You'll be able to run any artisan commands via docker-compose like so:
 
- ```shell script
-docker-compose run app php artisan list 
+```shell script
+docker-compose run app php artisan list
 ```
 
 The docker-compose setup runs an instance of [MailHog](https://github.com/mailhog/MailHog) and sets environment variables to redirect any BookStack-sent emails to MailHog. You can view this mail via the MailHog web interface on `localhost:8025`. You can change the port MailHog is accessible on by setting a `DEV_MAIL_PORT` environment variable.
 
+#### Running tests
+
+After starting the general development Docker, seed the testing database:
+ ```shell script
+# this is to be done only once
+docker-compose run app php artisan db:seed --class=DummyContentSeeder --database=mysql_testing
+```
+
+Once the database has been seeded, you can run the tests by:
+ ```shell script
+docker-compose run app php vendor/bin/phpunit
+```
 ## ðŸŒŽ Translations
 
 Translations for text within BookStack is managed through the [BookStack project on Crowdin](https://crowdin.com/project/bookstack). Some strings have colon-prefixed variables in such as `:userName`. Leave these values as they are as they will be replaced at run-time. Crowdin is the preferred way to provide translations, otherwise the raw translations files can be found within the `resources/lang` path.