From 1be2969055e083fa9b193fe86646142b5d261520 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Tue, 18 Nov 2025 19:47:41 +0000 Subject: [PATCH] Dev: Set timezone for test DB creation, added PHP 8.5 to tests Also fixed some test namespaces Related to #5881 --- .github/workflows/test-migrations.yml | 2 +- .github/workflows/test-php.yml | 2 +- composer.json | 1 + database/seeders/DummyContentSeeder.php | 5 +---- dev/docs/development.md | 4 ++-- dev/docs/php-testing.md | 2 +- tests/Activity/CommentsApiTest.php | 2 +- tests/Entity/EntityQueryTest.php | 2 +- 8 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test-migrations.yml b/.github/workflows/test-migrations.yml index 23e58a772..80075c3f7 100644 --- a/.github/workflows/test-migrations.yml +++ b/.github/workflows/test-migrations.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-24.04 strategy: matrix: - php: ['8.2', '8.3', '8.4'] + php: ['8.2', '8.3', '8.4', '8.5'] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/test-php.yml b/.github/workflows/test-php.yml index 64132f673..5f4c16caf 100644 --- a/.github/workflows/test-php.yml +++ b/.github/workflows/test-php.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-24.04 strategy: matrix: - php: ['8.2', '8.3', '8.4'] + php: ['8.2', '8.3', '8.4', '8.5'] steps: - uses: actions/checkout@v4 diff --git a/composer.json b/composer.json index 2285a22cb..ab33e87a4 100644 --- a/composer.json +++ b/composer.json @@ -93,6 +93,7 @@ "@php artisan view:clear" ], "refresh-test-database": [ + "@putenv APP_TIMEZONE=UTC", "@php artisan migrate:refresh --database=mysql_testing", "@php artisan db:seed --class=DummyContentSeeder --database=mysql_testing" ] diff --git a/database/seeders/DummyContentSeeder.php b/database/seeders/DummyContentSeeder.php index 5f787259a..845bea8e4 100644 --- a/database/seeders/DummyContentSeeder.php +++ b/database/seeders/DummyContentSeeder.php @@ -13,7 +13,6 @@ use BookStack\Search\SearchIndex; use BookStack\Users\Models\Role; use BookStack\Users\Models\User; use Illuminate\Database\Eloquent\Relations\HasMany; -use Illuminate\Database\Eloquent\Relations\Relation; use Illuminate\Database\Seeder; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Hash; @@ -23,10 +22,8 @@ class DummyContentSeeder extends Seeder { /** * Run the database seeds. - * - * @return void */ - public function run() + public function run(): void { // Create an editor user $editorUser = User::factory()->create(); diff --git a/dev/docs/development.md b/dev/docs/development.md index ea3e692a1..6c250902a 100644 --- a/dev/docs/development.md +++ b/dev/docs/development.md @@ -7,7 +7,7 @@ When it's time for a release the `development` branch is merged into release wit ## Building CSS & JavaScript Assets -This project uses SASS for CSS development and this is built, along with the JavaScript, using a range of npm scripts. The below npm commands can be used to install the dependencies & run the build tasks: +This project uses SASS for CSS development which is built, along with the JavaScript, using a range of npm scripts. The below npm commands can be used to install the dependencies & run the build tasks: ``` bash # Install NPM Dependencies @@ -113,4 +113,4 @@ docker-compose run app php vendor/bin/phpunit ### Debugging The docker-compose setup ships with Xdebug, which you can listen to on port 9090. -NB : For some editors like Visual Studio Code, you might need to map your workspace folder to the /app folder within the docker container for this to work. +NB: For some editors like Visual Studio Code, you might need to map your workspace folder to the /app folder within the docker container for this to work. diff --git a/dev/docs/php-testing.md b/dev/docs/php-testing.md index 1bd4a414f..3d3e91fa2 100644 --- a/dev/docs/php-testing.md +++ b/dev/docs/php-testing.md @@ -4,7 +4,7 @@ BookStack has many test cases defined within the `tests/` directory of the app. ## Setup -The application tests are mostly functional, rather than unit tests, meaning they simulate user actions and system components and therefore these require use of the database. To avoid potential conflicts within your development environment, the tests use a separate database. This is defined via a specific `mysql_testing` database connection in our configuration, and expects to use the following database access details: +The application tests are mostly functional, rather than unit tests, meaning they simulate user actions and system components, and therefore these require use of the database. To avoid potential conflicts within your development environment, the tests use a separate database. This is defined via a specific `mysql_testing` database connection in our configuration, and expects to use the following database access details: - Host: `127.0.0.1` - Username: `bookstack-test` diff --git a/tests/Activity/CommentsApiTest.php b/tests/Activity/CommentsApiTest.php index ec4ddba99..51009da39 100644 --- a/tests/Activity/CommentsApiTest.php +++ b/tests/Activity/CommentsApiTest.php @@ -1,6 +1,6 @@