Completed
Push — master ( 2aac5a...eaa64a )
by amaury
06:55
created

findOneTransverseBlockByCodeTest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 3
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 findOneTransverseBlockByCodeTest($code, $language, $count)
66
    {
67
        $blocks = $this->repository->findOneTransverseBlockByCode($code, $language, "2");
0 ignored issues
show
Bug introduced by
The method findOneTransverseBlockByCode() does not exist on OpenOrchestra\ModelBundl...ository\BlockRepository. Did you maybe mean findOneTransverseBlockByCodeAndLanguage()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
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