diff --git a/.idea/php.xml b/.idea/php.xml index 9144d49..49f80d7 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -11,14 +11,16 @@ - - - + + + + + - - + + + - diff --git a/CHANGELOG.md b/CHANGELOG.md index 463f5cb..c90335e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.1.4] - Ongoing + +This update introduces a minor bug fix + +### Fixed + - Fixed regex pattern for configuration properties being considered invalid when they contain an underscore. + + ## [1.1.3] - 2024-10-13 This update introduces a new build system diff --git a/src/ConfigLib/Configuration.php b/src/ConfigLib/Configuration.php index 7567b06..24be647 100644 --- a/src/ConfigLib/Configuration.php +++ b/src/ConfigLib/Configuration.php @@ -167,11 +167,10 @@ */ private static function validateKey(string $input): bool { - if (preg_match('/^([a-zA-Z0-9_]+\.?)+$/', $input)) + if (preg_match('/^[a-zA-Z0-9_]+(\.[a-zA-Z0-9_]+)*$/', $input)) { return true; } - return false; } diff --git a/tests/ConfigLib/ConfigurationTest.php b/tests/ConfigLib/ConfigurationTest.php index 2f8330b..2ec4b21 100644 --- a/tests/ConfigLib/ConfigurationTest.php +++ b/tests/ConfigLib/ConfigurationTest.php @@ -9,7 +9,11 @@ class ConfigurationTest extends TestCase public static function setUpBeforeClass(): void { $config = new Configuration('test'); - unlink($config->getPath()); + + if(file_exists($config->getPath())) + { + unlink($config->getPath()); + } } public function testConstruct(): void @@ -24,6 +28,7 @@ class ConfigurationTest extends TestCase $this->assertTrue($config->set('key1.key2', 'value', true)); $this->assertEquals('value', $config->get('key1.key2')); + } public function testSetNotExists(): void