From 7aa533b29abe548f5799cec2e306d2fabd5cc04d Mon Sep 17 00:00:00 2001 From: Alexandru Boia Date: Mon, 29 Apr 2024 16:53:04 +0300 Subject: [PATCH] Some case-sensitivity-related changes. --- lib/Plugin.php | 12 +++++++++++- tests/test-IoFileInfo.php | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/lib/Plugin.php b/lib/Plugin.php index 1b23d7b..fecc155 100644 --- a/lib/Plugin.php +++ b/lib/Plugin.php @@ -376,7 +376,17 @@ public function getAuditLogProvider() { } private function _determineReadmeTxtFilePath() { - return ABP01_PLUGIN_ROOT . '/readme.txt'; + $regularFile = ABP01_PLUGIN_ROOT . '/readme.txt'; + if (is_readable($regularFile)) { + return $regularFile; + } + + $devFile = ABP01_PLUGIN_ROOT . '/README.txt'; + if (is_readable($devFile)) { + return $devFile; + } + + return null; } public function getViewerDataSourceCache() { diff --git a/tests/test-IoFileInfo.php b/tests/test-IoFileInfo.php index 010156b..df0ed41 100644 --- a/tests/test-IoFileInfo.php +++ b/tests/test-IoFileInfo.php @@ -32,6 +32,22 @@ class IoFileInfoTests extends WP_UnitTestCase { use GenericTestHelpers; + protected function setUp(): void { + parent::setUp(); + $this->_removeAllLogFiles(); + } + + protected function tearDown(): void { + parent::tearDown(); + $this->_removeAllLogFiles(); + } + + private function _removeAllLogFiles() { + $dir = WP_CONTENT_DIR; + $this->_removeAllFiles($dir, 'f_rand_*.txt'); + $this->_removeAllFiles($dir, 'f_rand_*.log'); + } + public function test_canGetId() { $fileData = $this->_generateRandomTestFile(); $filePath = $fileData['path']; @@ -83,6 +99,8 @@ public function test_canGetContents_whenFileExists_notEmpty() { public function test_canGetContents_whenFileDoesntExist() { $bogusFilePath = $this->_generateRandomTestFilePath(); + var_dump($bogusFilePath); + $fileInfo = new Abp01_Io_FileInfo($bogusFilePath); $readContents = $fileInfo->contents();