Skip to content

Commit

Permalink
Sync changes with other apps (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
xepozz committed Nov 20, 2022
1 parent a55192f commit 9992ee3
Show file tree
Hide file tree
Showing 18 changed files with 224 additions and 41 deletions.
2 changes: 2 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
YII_ENV=test
YII_DEBUG=true
31 changes: 19 additions & 12 deletions codeception.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
namespace: App\Console\Tests
namespace: App\Tests
support_namespace: Support
paths:
tests: tests
output: runtime/tests/_output
data: tests/Support/Data
support: tests/Support
envs: tests/_envs
tests: tests
output: runtime/tests/_output
data: tests/Support/Data
support: tests/Support
envs: tests/_envs
actor_suffix: Tester
extensions:
enabled:
- Codeception\Extension\RunFailed
enabled:
- Codeception\Extension\RunFailed
settings:
suite_class: \PHPUnit_Framework_TestSuite
memory_limit: 1024M
colors: true
coverage:
enabled: true
whitelist:
include:
- src/*
enabled: true
whitelist:
include:
- src/*
params:
- .env
- .env.test
25 changes: 21 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"yiisoft/log": "^2.0",
"yiisoft/log-target-file": "^2.0",
"yiisoft/yii-console": "^1.3",
"yiisoft/yii-runner-console": "^1.0"
"yiisoft/yii-runner-console": "^1.1"
},
"require-dev": {
"codeception/codeception": "^5.0",
Expand All @@ -49,12 +49,12 @@
},
"autoload": {
"psr-4": {
"App\\Console\\": "src"
"App\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"App\\Console\\Tests\\": "tests"
"App\\Tests\\": "tests"
}
},
"extra": {
Expand All @@ -64,6 +64,23 @@
"config-plugin-options": {
"source-directory": "config"
},
"config-plugin-environments": {
"dev": {
"params": [
"test/params.php"
]
},
"prod": {
"params": [
"test/params.php"
]
},
"test": {
"params": [
"test/params.php"
]
}
},
"config-plugin": {
"params": "params.php",
"bootstrap": "bootstrap.php",
Expand Down Expand Up @@ -104,7 +121,7 @@
}
},
"scripts": {
"test": "phpunit --testdox --no-interaction",
"test": "codecept run",
"test-watch": "phpunit-watcher watch"
}
}
144 changes: 144 additions & 0 deletions config/.merge-plan.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<?php

declare(strict_types=1);

// Do not edit. Content will be replaced.
return [
'/' => [
'params' => [
'yiisoft/aliases' => [
'config/params.php',
],
'yiisoft/log-target-file' => [
'config/params.php',
],
'yiisoft/yii-console' => [
'config/params.php',
],
'/' => [
'params.php',
],
],
'common' => [
'yiisoft/aliases' => [
'config/common.php',
],
'yiisoft/log-target-file' => [
'config/common.php',
],
'yiisoft/yii-event' => [
'config/common.php',
],
'/' => [
'common/*.php',
],
],
'events-console' => [
'yiisoft/log' => [
'config/events-console.php',
],
'yiisoft/yii-console' => [
'config/events-console.php',
],
'yiisoft/yii-event' => [
'$events',
'config/events-console.php',
],
'/' => [
'$events',
'events-console.php',
],
],
'events-web' => [
'yiisoft/log' => [
'config/events-web.php',
],
'yiisoft/yii-event' => [
'$events',
'config/events-web.php',
],
],
'console' => [
'yiisoft/yii-console' => [
'config/console.php',
],
'yiisoft/yii-event' => [
'config/console.php',
],
'/' => [
'$common',
'console/*.php',
],
],
'providers-console' => [
'yiisoft/yii-console' => [
'config/providers-console.php',
],
'/' => [
'$providers',
'providers-console.php',
],
],
'events' => [
'yiisoft/yii-event' => [
'config/events.php',
],
'/' => [
'events.php',
],
],
'web' => [
'yiisoft/yii-event' => [
'config/web.php',
],
],
'bootstrap' => [
'/' => [
'bootstrap.php',
],
],
'bootstrap-console' => [
'/' => [
'$bootstrap',
'bootstrap-console.php',
],
],
'providers' => [
'/' => [
'providers.php',
],
],
'delegates' => [
'/' => [
'delegates.php',
],
],
'delegates-console' => [
'/' => [
'$delegates',
'delegates-console.php',
],
],
],
'dev' => [
'params' => [
'/' => [
'test/params.php',
],
],
],
'prod' => [
'params' => [
'/' => [
'test/params.php',
],
],
],
'test' => [
'params' => [
'/' => [
'test/params.php',
],
],
],
];
5 changes: 5 additions & 0 deletions config/dev/params.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

declare(strict_types=1);

return [];
4 changes: 2 additions & 2 deletions config/params.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

use App\Console\Hello;
use App\Command\HelloCommand;

return [
'yiisoft/aliases' => [
Expand All @@ -14,7 +14,7 @@

'yiisoft/yii-console' => [
'commands' => [
'hello' => Hello::class,
HelloCommand::$defaultName => HelloCommand::class,
],
],
];
5 changes: 5 additions & 0 deletions config/prod/params.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

declare(strict_types=1);

return [];
5 changes: 5 additions & 0 deletions config/test/params.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

declare(strict_types=1);

return [];
6 changes: 3 additions & 3 deletions src/Hello.php → src/Command/HelloCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Console;
namespace App\Command;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
Expand All @@ -11,9 +11,9 @@
use Symfony\Component\Console\Output\OutputInterface;
use Yiisoft\Yii\Console\ExitCode;

final class Hello extends Command
final class HelloCommand extends Command
{
protected static $defaultName = 'hello';
public static $defaultName = 'hello';
protected static $defaultDescription = 'An example command';

private string $sentence = 'sentence';
Expand Down
Empty file removed tests/Acceptance/.gitkeep
Empty file.
6 changes: 3 additions & 3 deletions tests/Cli.suite.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
actor: CliTester
suite_namespace: App\Console\Tests\Cli
modules:
# enable helpers as array
enabled: [Cli]
enabled:
- Cli
step_decorators: ~
4 changes: 2 additions & 2 deletions tests/Cli/ConsoleCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace App\Console\Tests\Cli;
namespace App\Tests\Cli;

use App\Console\Tests\Support\CliTester;
use App\Tests\Support\CliTester;

final class ConsoleCest
{
Expand Down
Empty file removed tests/Functional/.gitkeep
Empty file.
6 changes: 4 additions & 2 deletions tests/Support/CliTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

declare(strict_types=1);

namespace App\Console\Tests\Support;
namespace App\Tests\Support;

use Codeception\Actor;

/**
* Inherited Methods
Expand All @@ -19,7 +21,7 @@
*
* @SuppressWarnings(PHPMD)
*/
class CliTester extends \Codeception\Actor
class CliTester extends Actor
{
use _generated\CliTesterActions;

Expand Down
6 changes: 4 additions & 2 deletions tests/Support/UnitTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

declare(strict_types=1);

namespace App\Console\Tests\Support;
namespace App\Tests\Support;

use Codeception\Actor;

/**
* Inherited Methods
Expand All @@ -19,7 +21,7 @@
*
* @SuppressWarnings(PHPMD)
*/
class UnitTester extends \Codeception\Actor
class UnitTester extends Actor
{
use _generated\UnitTesterActions;

Expand Down
10 changes: 3 additions & 7 deletions tests/Unit.suite.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# Codeception Test Suite Configuration
#
# Suite for unit or integration tests.

actor: UnitTester
modules:
enabled:
- Asserts
step_decorators: ~
enabled:
- Asserts
step_decorators: ~
4 changes: 2 additions & 2 deletions tests/Unit/HelloCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace App\Console\Tests\Unit;
namespace App\Tests\Unit;

use App\Console\Tests\Support\UnitTester;
use App\Tests\Support\UnitTester;
use Psr\Container\ContainerInterface;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\CommandLoader\ContainerCommandLoader;
Expand Down
2 changes: 0 additions & 2 deletions tests/_output/.gitignore

This file was deleted.

0 comments on commit 9992ee3

Please sign in to comment.