File tree Expand file tree Collapse file tree 6 files changed +35
-4
lines changed
Expand file tree Collapse file tree 6 files changed +35
-4
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,13 @@ and this project follows [Semantic Versioning](https://semver.org/lang/ru/).
77
88## [ Unreleased]
99
10+ ## [ 1.1.1] - 2025-09-24
11+
12+ ### Changed
13+
14+ - Namespace changed from ` Codemonster ` to ` Codemonster\Env ` .
15+ - Added support for tests with single and double quotes (` '...' ` and ` "..." ` ) in ` .env ` .
16+
1017## [ 1.1.0] - 2025-09-23
1118
1219### Added
@@ -33,5 +40,6 @@ and this project follows [Semantic Versioning](https://semver.org/lang/ru/).
3340---
3441
3542[ Unreleased ] : https://github.com/codemonster-ru/env-php/compare/v1.1.0...HEAD
43+ [ 1.1.1 ] : https://github.com/codemonster-ru/env-php/compare/v1.1.0...v1.1.1
3644[ 1.1.0 ] : https://github.com/codemonster-ru/env-php/compare/v1.0.0...v1.1.0
3745[ 1.0.0 ] : https://github.com/codemonster-ru/env-php/releases/tag/v1.0.0
Original file line number Diff line number Diff line change 1414 ],
1515 "autoload" : {
1616 "psr-4" : {
17- "Codemonster\\ " : " src/"
17+ "Codemonster\\ Env \\ " : " src/"
1818 },
1919 "files" : [
2020 " src/helpers.php"
Original file line number Diff line number Diff line change 11<?php
22
3- namespace Codemonster ;
3+ namespace Codemonster \ Env ;
44
55class Env
66{
Original file line number Diff line number Diff line change 11<?php
22
3- use Codemonster \Env ;
3+ use Codemonster \Env \ Env ;
44
55if (!function_exists ('env ' )) {
66 function env (string $ key , mixed $ default = null ): mixed
Original file line number Diff line number Diff line change @@ -7,3 +7,6 @@ OPTIONAL_VALUE=null
77EMPTY_VALUE = empty
88
99SSR_URL = " http://localhost:3000"
10+
11+ QUOTED_SINGLE = ' Hello Single'
12+ QUOTED_DOUBLE = " Hello Double"
Original file line number Diff line number Diff line change 11<?php
22
3- use Codemonster \Env ;
3+ use Codemonster \Env \ Env ;
44use PHPUnit \Framework \TestCase ;
55
66class EnvTest extends TestCase
77{
88 protected function setUp (): void
99 {
10+ foreach ([
11+ 'APP_NAME ' ,
12+ 'FEATURE_ENABLED ' ,
13+ 'FEATURE_DISABLED ' ,
14+ 'OPTIONAL_VALUE ' ,
15+ 'EMPTY_VALUE ' ,
16+ 'SSR_URL ' ,
17+ 'QUOTED_SINGLE ' ,
18+ 'QUOTED_DOUBLE '
19+ ] as $ key ) {
20+ unset($ _ENV [$ key ], $ _SERVER [$ key ]);
21+ putenv ($ key );
22+ }
23+
1024 Env::load (__DIR__ . '/.env.example ' );
1125 }
1226
@@ -36,6 +50,12 @@ public function testEnvRemovesQuotes(): void
3650 $ this ->assertSame ('http://localhost:3000 ' , env ('SSR_URL ' ));
3751 }
3852
53+ public function testEnvHandlesSingleAndDoubleQuotes (): void
54+ {
55+ $ this ->assertSame ('Hello Single ' , env ('QUOTED_SINGLE ' ));
56+ $ this ->assertSame ('Hello Double ' , env ('QUOTED_DOUBLE ' ));
57+ }
58+
3959 public function testEnvReturnsDefaultIfNotSet (): void
4060 {
4161 $ this ->assertSame ('default ' , env ('NOT_DEFINED ' , 'default ' ));
You can’t perform that action at this time.
0 commit comments