Skip to content

Commit

Permalink
Adapt configuration group names to Yii conventions (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik committed Feb 17, 2023
1 parent 326e17b commit c5d69af
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 13 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/bc.yml
Expand Up @@ -5,11 +5,9 @@ on:
name: backwards compatibility
jobs:
roave_bc_check:
name: Roave BC Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Roave BC Check
uses: docker://nyholm/roave-bc-check-ga
uses: yiisoft/actions/.github/workflows/bc.yml@master
with:
os: >-
['ubuntu-latest']
php: >-
['8.0']
4 changes: 2 additions & 2 deletions CHANGELOG.md
@@ -1,8 +1,8 @@
# Yii Router FastRoute adapter Change Log

## 2.1.1 under development
## 3.0.0 under development

- no changes in this release.
- Chg #122: Adapt configuration group names to Yii conventions (@vjik)

## 2.1.0 January 09, 2023

Expand Down
7 changes: 4 additions & 3 deletions composer.json
Expand Up @@ -32,7 +32,8 @@
"rector/rector": "^0.15.4",
"roave/infection-static-analysis-plugin": "^1.16",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^4.30|^5.4"
"vimeo/psalm": "^4.30|^5.6",
"yiisoft/di": "^1.2"
},
"provide": {
"yiisoft/router-implementation": "1.0.0"
Expand All @@ -53,8 +54,8 @@
},
"config-plugin": {
"params": "params.php",
"common": "common.php",
"web": "web.php"
"di": "di.php",
"di-web": "di-web.php"
}
},
"config": {
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions psalm.xml
@@ -1,6 +1,8 @@
<?xml version="1.0"?>
<psalm
errorLevel="1"
findUnusedBaselineEntry="true"
findUnusedCode="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
Expand Down
59 changes: 59 additions & 0 deletions tests/ConfigTest.php
@@ -0,0 +1,59 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Router\FastRoute\Tests;

use PHPUnit\Framework\TestCase;
use Yiisoft\Di\Container;
use Yiisoft\Di\ContainerConfig;
use Yiisoft\Router\FastRoute\UrlGenerator;
use Yiisoft\Router\FastRoute\UrlMatcher;
use Yiisoft\Router\RouteCollectionInterface;
use Yiisoft\Router\UrlGeneratorInterface;
use Yiisoft\Router\UrlMatcherInterface;

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

$urlGenerator = $container->get(UrlGeneratorInterface::class);

$this->assertInstanceOf(UrlGenerator::class, $urlGenerator);
}

public function testDiWeb(): void
{
$container = $this->createContainer('web');

$urlMatcher = $container->get(UrlMatcherInterface::class);

$this->assertInstanceOf(UrlMatcher::class, $urlMatcher);
}

private function createContainer(?string $postfix = null): Container
{
return new Container(
ContainerConfig::create()->withDefinitions(
$this->getDiConfig($postfix)
+
[
RouteCollectionInterface::class => $this->createMock(RouteCollectionInterface::class),
]
)
);
}

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

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

0 comments on commit c5d69af

Please sign in to comment.