From 624ff4a54d8f768021c6957ef577aea1c8a8bcb9 Mon Sep 17 00:00:00 2001 From: Takashi Matsuo Date: Mon, 26 Mar 2018 16:08:38 -0700 Subject: [PATCH 1/2] Add a static function for the location of the prepend file --- ErrorReporting/src/Bootstrap.php | 11 +++++++++++ ErrorReporting/tests/Unit/BootstrapTest.php | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/ErrorReporting/src/Bootstrap.php b/ErrorReporting/src/Bootstrap.php index 8c3f0dccd61a..7f63182d226b 100644 --- a/ErrorReporting/src/Bootstrap.php +++ b/ErrorReporting/src/Bootstrap.php @@ -15,6 +15,17 @@ class Bootstrap /** @var PsrLogger */ public static $psrLogger; + /** + * Return the full path of the prepend file. + * + * @return string + */ + public static function prependFileLocation() + { + // Now it's in the same directory. + return realpath(__DIR__ . '/prepend.php'); + } + /** * Register hooks for error reporting. * diff --git a/ErrorReporting/tests/Unit/BootstrapTest.php b/ErrorReporting/tests/Unit/BootstrapTest.php index 44dc47fb0679..b63ff5122d98 100644 --- a/ErrorReporting/tests/Unit/BootstrapTest.php +++ b/ErrorReporting/tests/Unit/BootstrapTest.php @@ -40,6 +40,14 @@ public function setUp() $this->psrBatchLogger = $this->prophesize(PsrLogger::class); } + public function testGetPrependFilePath() + { + $prependFileLocation = Bootstrap::prependFileLocation(); + $this->assertFileExists( + $prependFileLocation, + "The prepend file doesn't exist at $prependFileLocation"); + } + /** * @dataProvider levelAndErrorPrefixProvider */ From b724f5e6fedd95cc0463241269c2d2ba8d87f31c Mon Sep 17 00:00:00 2001 From: Takashi Matsuo Date: Mon, 26 Mar 2018 16:14:34 -0700 Subject: [PATCH 2/2] Fixed the test method name --- ErrorReporting/tests/Unit/BootstrapTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ErrorReporting/tests/Unit/BootstrapTest.php b/ErrorReporting/tests/Unit/BootstrapTest.php index b63ff5122d98..0d3b6f0ea615 100644 --- a/ErrorReporting/tests/Unit/BootstrapTest.php +++ b/ErrorReporting/tests/Unit/BootstrapTest.php @@ -40,7 +40,7 @@ public function setUp() $this->psrBatchLogger = $this->prophesize(PsrLogger::class); } - public function testGetPrependFilePath() + public function testPrependFileLocation() { $prependFileLocation = Bootstrap::prependFileLocation(); $this->assertFileExists(