1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace OpenOrchestra\FunctionalTests\ModelBundle\Repository; |
4
|
|
|
|
5
|
|
|
use OpenOrchestra\BaseBundle\Tests\AbstractTest\AbstractKernelTestCase; |
6
|
|
|
use OpenOrchestra\ModelBundle\Repository\BlockRepository; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class BlockRepositoryTest |
10
|
|
|
* |
11
|
|
|
* @group integrationTest |
12
|
|
|
*/ |
13
|
|
|
class BlockRepositoryTest extends AbstractKernelTestCase |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* @var BlockRepository |
17
|
|
|
*/ |
18
|
|
|
protected $repository; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Set up test |
22
|
|
|
*/ |
23
|
|
|
protected function setUp() |
24
|
|
|
{ |
25
|
|
|
parent::setUp(); |
26
|
|
|
|
27
|
|
|
static::bootKernel(); |
28
|
|
|
$this->repository = static::$kernel->getContainer()->get('open_orchestra_model.repository.block'); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @param int $count |
33
|
|
|
* @param string $component |
34
|
|
|
* @param string $language |
35
|
|
|
* @param string $siteId |
36
|
|
|
* |
37
|
|
|
* @dataProvider provideLanguageAndVersionListAndSiteId |
38
|
|
|
*/ |
39
|
|
|
public function testFindTransverseBlock($count, $component, $language, $siteId) |
40
|
|
|
{ |
41
|
|
|
$blocks = $this->repository->findTransverseBlock($component, $siteId, $language); |
42
|
|
|
$this->assertCount($count, $blocks); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @return array |
47
|
|
|
*/ |
48
|
|
|
public function provideLanguageAndVersionListAndSiteId() |
49
|
|
|
{ |
50
|
|
|
return array( |
51
|
|
|
array(0,'fake_component', 'en', '2'), |
52
|
|
|
array(2, 'tiny_mce_wysiwyg', 'fr', '2'), |
53
|
|
|
array(2, 'tiny_mce_wysiwyg', 'en', '2'), |
54
|
|
|
array(1, 'menu', 'en', '2'), |
55
|
|
|
); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @param string $code |
60
|
|
|
* @param string $language |
61
|
|
|
* @param int $count |
62
|
|
|
* |
63
|
|
|
* @dataProvider provideBlockCode |
64
|
|
|
*/ |
65
|
|
|
public function findOneTransverseBlockByCodeAndLanguageTest($code, $language, $count) |
66
|
|
|
{ |
67
|
|
|
$blocks = $this->repository->findOneTransverseBlockByCodeAndLanguage($code, $language); |
68
|
|
|
$this->assertCount($count, $blocks); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @return array |
73
|
|
|
*/ |
74
|
|
|
public function provideBlockCode() |
75
|
|
|
{ |
76
|
|
|
return array( |
77
|
|
|
array('logo', 'en', 1), |
78
|
|
|
array('logo', 'fr', 1), |
79
|
|
|
array('footer', 'fr', 1), |
80
|
|
|
array('footer', 'de', 1), |
81
|
|
|
array('fake', 'de', 0), |
82
|
|
|
array('fake', 'en', 0), |
83
|
|
|
array('fake', 'fr', 0), |
84
|
|
|
); |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
|