Skip to content

Commit

Permalink
Adapt configuration group names to Yii conventions (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik committed Feb 13, 2023
1 parent 21ce10b commit 6563b94
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 4 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
@@ -1,8 +1,9 @@
# Yii Session Change Log

## 1.1.1 under development
## 2.0.0 under development

- Fix #45: Returns correct session name when used custom name and call `Session::getName()` before session open (@vjik)
- Chg #47: Adapt configuration group names to Yii conventions (@vjik)

## 1.1.0 October 28, 2022

Expand All @@ -18,7 +19,7 @@

## 1.0.2 April 13, 2021

- Chg: Adjust config for yiisoft/factory changes (@vjik, @samdark)
- Chg: Adjust config for `yiisoft/factory` changes (@vjik, @samdark)

## 1.0.1 March 23, 2021

Expand Down
5 changes: 3 additions & 2 deletions composer.json
Expand Up @@ -41,7 +41,8 @@
"phpunit/phpunit": "^9.5",
"roave/infection-static-analysis-plugin": "^1.16",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^4.30|^5.6"
"vimeo/psalm": "^4.30|^5.6",
"yiisoft/di": "^1.1"
},
"autoload": {
"psr-4": {
Expand All @@ -58,7 +59,7 @@
"source-directory": "config"
},
"config-plugin": {
"web": "web.php",
"di-web": "di-web.php",
"params": "params.php"
}
},
Expand Down
File renamed without changes.
49 changes: 49 additions & 0 deletions tests/ConfigTest.php
@@ -0,0 +1,49 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Session\Tests;

use PHPUnit\Framework\TestCase;
use Yiisoft\Di\Container;
use Yiisoft\Di\ContainerConfig;
use Yiisoft\Session\Flash\Flash;
use Yiisoft\Session\Flash\FlashInterface;
use Yiisoft\Session\Session;
use Yiisoft\Session\SessionInterface;

final class ConfigTest extends TestCase
{
public function testBase(): void
{
$container = $this->createContainer();

$session = $container->get(SessionInterface::class);
$flash = $container->get(FlashInterface::class);

$this->assertInstanceOf(Session::class, $session);
$this->assertInstanceOf(Flash::class, $flash);
}

private function createContainer(?array $params = null): Container
{
return new Container(
ContainerConfig::create()->withDefinitions(
$this->getDiConfig($params)
)
);
}

private function getDiConfig(?array $params = null): array
{
if ($params === null) {
$params = $this->getParams();
}
return require dirname(__DIR__) . '/config/di-web.php';
}

private function getParams(): array
{
return require dirname(__DIR__) . '/config/params.php';
}
}

0 comments on commit 6563b94

Please sign in to comment.