Skip to content

Commit

Permalink
Move config to tests/config
Browse files Browse the repository at this point in the history
  • Loading branch information
mazarini committed Jan 20, 2024
1 parent 78b5f40 commit 469e8ef
Show file tree
Hide file tree
Showing 15 changed files with 62 additions and 24 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ phpstan:
~/.composer/vendor/bin/phpstan

yaml:
bin/console lint:yaml config phpstan.dist.neon
bin/console lint:yaml config
bin/console lint:yaml tests/config
bin/console lint:yaml phpstan.dist.neon

composer:
Expand Down
8 changes: 0 additions & 8 deletions config/bundles.php

This file was deleted.

5 changes: 0 additions & 5 deletions config/preload.php

This file was deleted.

2 changes: 1 addition & 1 deletion phpstan.dist.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ parameters:
level: 9
paths:
- bin/
- config/
- src/
- tests/config/
- tests/src
- tests/tests
25 changes: 25 additions & 0 deletions tests/config/bundles.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

/*
* Copyright (C) 2024 Mazarini <mazarini@protonmail.com>.
* This file is part of mazarini/config.
*
* mazarini/config is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* mazarini/config is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
*/

return [
App\AppBundle::class => ['all' => true],
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
];
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions tests/config/preload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

/*
* Copyright (C) 2024 Mazarini <mazarini@protonmail.com>.
* This file is part of mazarini/config.
*
* mazarini/config is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* mazarini/config is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
*/

if (file_exists(dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php')) {
require dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php';
}
2 changes: 1 addition & 1 deletion config/routes.yaml → tests/config/routes.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
controllers:
resource:
path: ../tests/src/Controller/
path: ../src/Controller/
namespace: App\Controller
type: attribute
File renamed without changes.
14 changes: 7 additions & 7 deletions config/services.yaml → tests/config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ services:
# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
App\:
resource: '../tests/src/'
resource: '../src/'
exclude:
- '../tests/src/Config/'
- '../tests/src/DependencyInjection/'
- '../tests/src/Service/'
- '../tests/src/Entity/'
- '../tests/src/Service/'
- '../tests/src/Kernel.php'
- '../src/Config/'
- '../src/DependencyInjection/'
- '../src/Service/'
- '../src/Entity/'
- '../src/Service/'
- '../src/Kernel.php'

# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones
5 changes: 5 additions & 0 deletions tests/src/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,9 @@
class Kernel extends BaseKernel
{
use MicroKernelTrait;

protected function getConfigDir(): string
{
return $this->getProjectDir().'/tests/config';
}
}

0 comments on commit 469e8ef

Please sign in to comment.