1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Yproximite\WannaSpeakBundle\Tests; |
4
|
|
|
|
5
|
|
|
use Symfony\Bundle\FrameworkBundle\FrameworkBundle; |
6
|
|
|
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; |
7
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
8
|
|
|
use Symfony\Component\HttpKernel\Kernel; |
9
|
|
|
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; |
10
|
|
|
use Symfony\Component\Routing\RouteCollectionBuilder; |
11
|
|
|
use Yproximite\WannaSpeakBundle\WannaSpeakBundle; |
12
|
|
|
|
13
|
|
|
abstract class AbstractWannaSpeakBundleTestKernel extends Kernel |
14
|
|
|
{ |
15
|
|
|
use MicroKernelTrait; |
16
|
|
|
|
17
|
|
|
public function __construct() |
18
|
|
|
{ |
19
|
|
|
parent::__construct('test', true); |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
public function registerBundles(): iterable |
23
|
|
|
{ |
24
|
|
|
return [ |
25
|
|
|
new FrameworkBundle(), |
26
|
|
|
new WannaSpeakBundle(), |
27
|
|
|
]; |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
protected function configureContainer(ContainerBuilder $containerBuilder): void |
31
|
|
|
{ |
32
|
|
|
$containerBuilder->loadFromExtension('framework', [ |
33
|
|
|
'secret' => 'my-secret', |
34
|
|
|
'test' => true, |
35
|
|
|
'router' => [ |
36
|
|
|
'utf8' => true, |
37
|
|
|
] |
38
|
|
|
]); |
39
|
|
|
|
40
|
|
|
$containerBuilder->loadFromExtension('wanna_speak', [ |
41
|
|
|
'api' => [ |
42
|
|
|
'credentials' => [ |
43
|
|
|
'account_id' => '9999999999', |
44
|
|
|
'secret_key' => '0000000000', |
45
|
|
|
], |
46
|
|
|
'base_url' => 'https://www-2.wannaspeak.com/api/api.php', |
47
|
|
|
'test' => true, |
48
|
|
|
], |
49
|
|
|
]); |
50
|
|
|
} |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
|
54
|
|
|
if (AbstractWannaSpeakBundleTestKernel::VERSION_ID >= 50100) { // @phpstan-ignore-line |
55
|
|
|
class WannaSpeakBundleTestKernel extends AbstractWannaSpeakBundleTestKernel |
56
|
|
|
{ |
57
|
|
|
protected function configureRoutes(RoutingConfigurator $routes): void |
58
|
|
|
{ |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
} else { // @phpstan-ignore-line |
62
|
|
|
class WannaSpeakBundleTestKernel extends AbstractWannaSpeakBundleTestKernel |
|
|
|
|
63
|
|
|
{ |
64
|
|
|
protected function configureRoutes(RouteCollectionBuilder $routes): void |
65
|
|
|
{ |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|
This check looks for classes that have been defined more than once in the same file.
If you can, we would recommend to use standard object-oriented programming techniques. For example, to avoid multiple types, it might make sense to create a common interface, and then multiple, different implementations for that interface.
This also has the side-effect of providing you with better IDE auto-completion, static analysis and also better OPCode caching from PHP.