Skip to content

Commit b05ca82

Browse files
authored
Use runner packages and HTTP application class (#209)
1 parent 0fb4043 commit b05ca82

11 files changed

Lines changed: 19 additions & 289 deletions

.scrutinizer.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ filter:
55
paths:
66
- "src/*"
77
excluded_paths:
8-
- "src/ApplicationRunner.php"
98
- "src/Installer.php"
109

1110
build:

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@
5252
"yiisoft/yii-console": "^1.0",
5353
"yiisoft/yii-debug": "^3.0@dev",
5454
"yiisoft/yii-event": "^1.0",
55+
"yiisoft/yii-http": "dev-master",
56+
"yiisoft/yii-runner-console": "dev-master",
57+
"yiisoft/yii-runner-http": "dev-master",
5558
"yiisoft/yii-view": "^4.0",
5659
"yiisoft/yii-web": "^3.0@dev"
5760
},

config/web/application.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
use Yiisoft\Injector\Injector;
99
use Yiisoft\Middleware\Dispatcher\MiddlewareDispatcher;
1010

11+
/** @var array $params */
12+
1113
return [
12-
Yiisoft\Yii\Web\Application::class => [
14+
Yiisoft\Yii\Http\Application::class => [
1315
'__construct()' => [
1416
'dispatcher' => DynamicReference::to(static function (Injector $injector) use ($params) {
1517
return ($injector->make(MiddlewareDispatcher::class))

public/index.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
use App\Runner\WebApplicationRunner;
5+
use Yiisoft\Yii\Runner\Http\HttpApplicationRunner;
66

77
/**
88
* @psalm-var string $_SERVER['REQUEST_URI']
@@ -30,6 +30,6 @@
3030
}
3131
}
3232

33-
// Run web application runner
34-
$runner = new WebApplicationRunner($_ENV['YII_DEBUG'], $_ENV['YII_ENV']);
33+
// Run HTTP application runner
34+
$runner = new HttpApplicationRunner(dirname(__DIR__), $_ENV['YII_DEBUG'], $_ENV['YII_ENV']);
3535
$runner->run();

src/Runner/BootstrapRunner.php

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/Runner/ConfigFactory.php

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/Runner/ConsoleApplicationRunner.php

Lines changed: 0 additions & 71 deletions
This file was deleted.

src/Runner/WebApplicationRunner.php

Lines changed: 0 additions & 140 deletions
This file was deleted.

tests/Functional/EventListenerConfigurationTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@
44

55
namespace App\Tests\Functional;
66

7-
use App\Runner\ConfigFactory;
87
use PHPUnit\Framework\TestCase;
98
use Psr\Container\ContainerInterface;
109
use Yiisoft\Di\Container;
1110
use Yiisoft\Yii\Event\ListenerConfigurationChecker;
11+
use Yiisoft\Yii\Runner\ConfigFactory;
12+
13+
use function dirname;
1214

1315
class EventListenerConfigurationTest extends TestCase
1416
{
1517
public function testConsoleListenerConfiguration(): void
1618
{
17-
$config = ConfigFactory::create(null);
19+
$config = ConfigFactory::create(dirname(__DIR__, 2), null);
1820

1921
$container = (new Container($config->get('console')))->get(ContainerInterface::class);
2022
$checker = $container->get(ListenerConfigurationChecker::class);

tests/Unit/HelloCest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace App\Tests\Unit;
66

7-
use App\Runner\ConfigFactory;
87
use App\Tests\UnitTester;
98
use Psr\Container\ContainerInterface;
109
use Symfony\Component\Console\Application;
@@ -13,6 +12,9 @@
1312
use Yiisoft\Config\Config;
1413
use Yiisoft\Di\Container;
1514
use Yiisoft\Yii\Console\ExitCode;
15+
use Yiisoft\Yii\Runner\ConfigFactory;
16+
17+
use function dirname;
1618

1719
final class HelloCest
1820
{
@@ -55,6 +57,6 @@ public function testExecute(UnitTester $I): void
5557

5658
private function getConfig(): Config
5759
{
58-
return ConfigFactory::create(null);
60+
return ConfigFactory::create(dirname(__DIR__, 2), null);
5961
}
6062
}

0 commit comments

Comments
 (0)