|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* |
|
5
|
|
|
* Copyright (C) 2015-2017 Libre Informatique |
|
6
|
|
|
* |
|
7
|
|
|
* This file is licenced under the GNU LGPL v3. |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE.md |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Blast\Bundle\CoreBundle\Tests\Functional; |
|
13
|
|
|
|
|
14
|
|
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; |
|
15
|
|
|
use Symfony\Component\DependencyInjection\Container; |
|
16
|
|
|
|
|
17
|
|
View Code Duplication |
class BlastCoreBundleTest extends KernelTestCase |
|
|
|
|
|
|
18
|
|
|
{ |
|
19
|
|
|
protected $container; |
|
20
|
|
|
|
|
21
|
|
|
protected function setUp() |
|
22
|
|
|
{ |
|
23
|
|
|
static::bootKernel(); |
|
24
|
|
|
|
|
25
|
|
|
/* @var Container $container */ |
|
26
|
|
|
$this->container = self::$kernel->getContainer(); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
public function testServicesAreInitializable() |
|
30
|
|
|
{ |
|
31
|
|
|
$serviceIds = array_filter($this->container->getServiceIds(), function ($serviceId) { |
|
32
|
|
|
return 0 === strpos($serviceId, 'blast_core.'); |
|
33
|
|
|
}); |
|
34
|
|
|
|
|
35
|
|
|
foreach ($serviceIds as $serviceId) { |
|
36
|
|
|
$this->assertNotNull($this->container->get($serviceId)); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
$this->assertContains('blast_core.form.type.entity_code', $serviceIds); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
public function testServicesExists() |
|
43
|
|
|
{ |
|
44
|
|
|
/* |
|
45
|
|
|
* @todo is it usefull to test if service exist or not |
|
46
|
|
|
*/ |
|
47
|
|
|
|
|
48
|
|
|
$this->assertContains('blast_core.code_generator_factory', $this->container->getServiceIds()); |
|
49
|
|
|
|
|
50
|
|
|
$this->assertContains('blast_core.code_generators', $this->container->getServiceIds()); |
|
51
|
|
|
$this->assertContains('blast_core.form.type.entity_code', $this->container->getServiceIds()); |
|
52
|
|
|
//$this->assertContains('blast_core.label.strategy.blast', $this->container->getServiceIds()); |
|
|
|
|
|
|
53
|
|
|
} |
|
54
|
|
|
} |
|
55
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.