Conflicting Timezones between test database seeder and phpunit tests #5491

Closed
opened 2026-02-05 10:06:45 +03:00 by OVERLORD · 1 comment
Owner

Originally created by @ramel-contria on GitHub (Nov 11, 2025).

Describe the Bug

Since v25.11 and the Introduction of the server arguments APP_TIMEZONE and APP_DISPLAY_TIMEZONE in phpunit.xml, tests fail if you have set the APP_TIMEZONE in the .env file to a different timezone. This occurs due to the seeder using the timezone set in .env and the tests using the timezone set in phpunit.xml. We found this bug when we updated and ran the tests localy, as we use Europe/Zurich as our APP_TIMEZONE.

Steps to Reproduce

  1. Change the APP_TIMEZONE in .env to something like Europe/Zurich or Antarctica/Vostok
  2. Run the database seeder with composer refresh-test-database
  3. Run the tests composer test

Expected Behaviour

Expected would be that the test-database seeder uses the APP_TIMEZONE of the phpunit.xml

Failing tests

AuditLogTest

  • test_shows_activity

PageDraftTest

  • test_alert_message_shows_if_someone_else_editing
  • test_draft_save_shows_alert_if_draft_edit_started_by_someone_else

PageTest

  • test_recently_updated_pages_view
  • test_recently_updated_pages_view_shows_parent_chain
  • test_recently_updated_pages_view_does_not_show_parent_if_not_visible
  • test_recently_updated_pages_on_home

UserApiTokenTest

  • test_create_api_token
  • test_user_manage_can_delete_token_without_api_permission_themselves

Screenshots or Additional Context

No response

Browser Details

No response

Exact BookStack Version

v25.11

Originally created by @ramel-contria on GitHub (Nov 11, 2025). ### Describe the Bug Since v25.11 and the Introduction of the server arguments `APP_TIMEZONE` and `APP_DISPLAY_TIMEZONE` in phpunit.xml, tests fail if you have set the `APP_TIMEZONE` in the `.env` file to a different timezone. This occurs due to the seeder using the timezone set in `.env` and the tests using the timezone set in `phpunit.xml`. We found this bug when we updated and ran the tests localy, as we use `Europe/Zurich` as our `APP_TIMEZONE`. ### Steps to Reproduce 1. Change the `APP_TIMEZONE` in `.env` to something like `Europe/Zurich` or `Antarctica/Vostok` 2. Run the database seeder with `composer refresh-test-database` 3. Run the tests `composer test` ### Expected Behaviour Expected would be that the test-database seeder uses the `APP_TIMEZONE` of the `phpunit.xml` ### Failing tests #### AuditLogTest - test_shows_activity #### PageDraftTest - test_alert_message_shows_if_someone_else_editing - test_draft_save_shows_alert_if_draft_edit_started_by_someone_else #### PageTest - test_recently_updated_pages_view - test_recently_updated_pages_view_shows_parent_chain - test_recently_updated_pages_view_does_not_show_parent_if_not_visible - test_recently_updated_pages_on_home #### UserApiTokenTest - test_create_api_token - test_user_manage_can_delete_token_without_api_permission_themselves ### Screenshots or Additional Context _No response_ ### Browser Details _No response_ ### Exact BookStack Version v25.11
OVERLORD added the 🐛 Bug label 2026-02-05 10:06:45 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Nov 18, 2025):

Thanks for reporting @ramel-contria,
Within 1be2969055 I've updated the composer refresh-test-database to now set the APP_TIMEZONE env variable to UTC which would then be used for the required migrate and seed operations.

@ssddanbrown commented on GitHub (Nov 18, 2025): Thanks for reporting @ramel-contria, Within 1be2969055e083fa9b193fe86646142b5d261520 I've updated the `composer refresh-test-database` to now set the `APP_TIMEZONE` env variable to `UTC` which would then be used for the required migrate and seed operations.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#5491