From 39ba140fda9edd6056a8702a1738c84544ef0bf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Fr=C3=A8rejean?= Date: Wed, 5 Apr 2023 09:28:16 +0200 Subject: [PATCH] Add stubs for `Page` and `PageController` to ensure these symbols exist. --- bootstrap.php | 10 ++++++++++ stubs/Page.php | 8 ++++++++ stubs/PageController.php | 8 ++++++++ 3 files changed, 26 insertions(+) create mode 100644 stubs/Page.php create mode 100644 stubs/PageController.php diff --git a/bootstrap.php b/bootstrap.php index 3ee3898..0191df2 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -17,6 +17,16 @@ exit(1); } +// Ensure that the `Page` and `PageController` classes exist, if they don't _(for example when testing a +// silverstripe module)_ ensure that the symbols are registered. +if (!class_exists(\Page::class)) { + require __DIR__ . '/stubs/Page.php'; +} + +if (!class_exists(\PageController::class)) { + require __DIR__ . '/stubs/PageController.php'; +} + // Ensure global $_SERVER exists global $_SERVER; if (!$_SERVER) { diff --git a/stubs/Page.php b/stubs/Page.php new file mode 100644 index 0000000..790c27d --- /dev/null +++ b/stubs/Page.php @@ -0,0 +1,8 @@ +