Skip to content

Commit f86c928

Browse files
authored
Adjust config (#181)
See yiisoft/config#73
1 parent ade3079 commit f86c928

6 files changed

Lines changed: 33 additions & 1 deletion

File tree

public/index-test.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
$_SERVER['SCRIPT_NAME'] = '/index-test.php';
2222
}
2323

24+
define('YII_ENV', getenv('env') ?: 'test');
25+
2426
require_once dirname(__DIR__) . '/vendor/autoload.php';
2527

2628
$runner = new ApplicationRunner();

public/index.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
$_SERVER['SCRIPT_NAME'] = '/index.php';
1616
}
1717

18+
define('YII_ENV', getenv('env') ?: 'production');
19+
1820
require_once dirname(__DIR__) . '/vendor/autoload.php';
1921

2022
$runner = new ApplicationRunner();

src/ApplicationRunner.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,14 @@ public function run(): void
4545

4646
$config = new Config(
4747
dirname(__DIR__),
48-
'/config/packages', // Configs path.
48+
'/config/packages',
49+
null,
50+
[
51+
'params',
52+
'events',
53+
'events-web',
54+
'events-console',
55+
]
4956
);
5057

5158
$container = new Container(

tests/Functional/EventListenerConfigurationTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ public function testConsoleListenerConfiguration(): void
1717
$config = new Config(
1818
dirname(__DIR__, 2),
1919
'/config/packages', // Configs path.
20+
null,
21+
[
22+
'params',
23+
'events',
24+
'events-web',
25+
'events-console',
26+
]
2027
);
2128

2229
$container = (new Container($config->get('console')))->get(ContainerInterface::class);

tests/Unit/HelloCest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ private function getConfig(): Config
5656
return new Config(
5757
dirname(__DIR__, 2),
5858
'/config/packages', // Configs path.
59+
null,
60+
[
61+
'params',
62+
'events',
63+
'events-web',
64+
'events-console',
65+
]
5966
);
6067
}
6168
}

yii

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ require_once 'vendor/autoload.php';
1616
$config = new Config(
1717
__DIR__,
1818
'/config/packages',
19+
null,
20+
[
21+
'params',
22+
'events',
23+
'events-web',
24+
'events-console',
25+
]
1926
);
2027

2128
$container = new Container(

0 commit comments

Comments
 (0)