Skip to content

Commit 3b7ef87

Browse files
committed
Set up core test cases
1 parent 4346fdf commit 3b7ef87

12 files changed

+148
-1
lines changed

composer.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,15 @@
3232
"phpstan/phpstan-phpunit": "^2.0.3",
3333
"phpstan/phpstan-symfony": "^2.0.1",
3434
"phpunit/phpunit": "^11.5.3",
35+
"symfony/browser-kit": "^6.4|^7.1",
36+
"symfony/css-selector": "^6.4|^7.1",
37+
"symfony/debug-bundle": "^6.4|^7.1",
3538
"symfony/dotenv": "^6.4|^7.1",
36-
"symfony/runtime": "^6.4|^7.1"
39+
"symfony/monolog-bundle": "^3.10",
40+
"symfony/routing": "^6.4|^7.1",
41+
"symfony/runtime": "^6.4|^7.1",
42+
"symfony/twig-bundle": "^6.4|^7.1",
43+
"symfony/web-profiler-bundle": "^6.4|^7.1"
3744
},
3845
"autoload": {
3946
"psr-4": { "Omines\\AntiSpamQuarantineBundle\\": "src/"}

tests/Fixture/bin/console

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
use Tests\Fixture\Kernel;
5+
use Symfony\Bundle\FrameworkBundle\Console\Application;
6+
7+
// This allows us to do the trick with the symlinked vendor folder shared with the main library
8+
$_SERVER['APP_RUNTIME_OPTIONS'] = ['project_dir' => dirname(__DIR__)];
9+
10+
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
11+
12+
return function (array $context) {
13+
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
14+
15+
return new Application($kernel);
16+
};

tests/Fixture/config/bundles.php

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
return [
4+
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
5+
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
6+
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
7+
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
8+
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
9+
Omines\AntiSpamBundle\AntiSpamBundle::class => ['all' => true],
10+
Omines\AntiSpamQuarantineBundle\AntiSpamQuarantineBundle::class => ['all' => true],
11+
];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# see https://symfony.com/doc/current/reference/configuration/framework.html
2+
framework:
3+
secret: '%env(APP_SECRET)%'
4+
#csrf_protection: true
5+
http_method_override: false
6+
handle_all_throwables: true
7+
8+
# Enables session support. Note that the session will ONLY be started if you read or write from it.
9+
# Remove or comment this section to explicitly disable session support.
10+
session:
11+
handler_id: null
12+
cookie_secure: auto
13+
cookie_samesite: lax
14+
storage_factory_id: session.storage.factory.native
15+
16+
#esi: true
17+
#fragments: true
18+
php_errors:
19+
log: true
20+
21+
when@test:
22+
framework:
23+
test: true
24+
session:
25+
storage_factory_id: session.storage.factory.mock_file
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
framework:
2+
default_locale: '%default_locale%'
3+
translator:
4+
default_path: '%kernel.project_dir%/translations'
5+
fallbacks:
6+
- en
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
when@dev:
2+
web_profiler:
3+
toolbar: true
4+
intercept_redirects: false
5+
6+
framework:
7+
profiler:
8+
only_exceptions: false
9+
collect_serializer_data: true
10+
11+
when@test:
12+
web_profiler:
13+
toolbar: false
14+
intercept_redirects: false
15+
16+
framework:
17+
profiler: { collect: false }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
when@dev:
2+
_errors:
3+
resource: '@FrameworkBundle/Resources/config/routing/errors.xml'
4+
prefix: /_error
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
when@dev:
2+
web_profiler_wdt:
3+
resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
4+
prefix: /_wdt
5+
6+
web_profiler_profiler:
7+
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
8+
prefix: /_profiler

tests/Fixture/config/services.yaml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# This file is the entry point to configure your own services.
2+
# Files in the packages/ subdirectory configure your dependencies.
3+
4+
# Put parameters here that don't need to change on each machine where the app is deployed
5+
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
6+
parameters:
7+
default_locale: en
8+
locales: en|nl|fr|de|ru
9+
10+
services:
11+
# default configuration for services in *this* file
12+
_defaults:
13+
autowire: true # Automatically injects dependencies in your services.
14+
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
15+
16+
# makes classes in src/ available to be used as services
17+
# this creates a service per class whose id is the fully-qualified class name
18+
Tests\Fixture\:
19+
resource: '../src/'
20+
exclude:
21+
- '../src/DependencyInjection/'
22+
- '../src/Entity/'
23+
- '../src/Kernel.php'
24+
25+
# add more service definitions when explicit configuration is needed
26+
# please note that last definitions always *replace* previous ones

tests/Fixture/src/.gitignore

Whitespace-only changes.

tests/Fixture/src/Kernel.php

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
/*
4+
* Symfony Anti-Spam Bundle
5+
* (c) Omines Internetbureau B.V. - https://omines.nl/
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
11+
declare(strict_types=1);
12+
13+
namespace Tests\Fixture;
14+
15+
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
16+
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
17+
18+
class Kernel extends BaseKernel
19+
{
20+
use MicroKernelTrait;
21+
22+
public function getProjectDir(): string
23+
{
24+
return dirname(__DIR__);
25+
}
26+
}

tests/Fixture/vendor

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../vendor

0 commit comments

Comments
 (0)