Completed
Pull Request — master (#917)
by Dmitry
08:52
created

ConfigManagerTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 32
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testInstantiate() 0 19 1
A testIncorrectInstantiate() 0 5 1
1
<?php
2
3
namespace FOS\ElasticaBundle\Tests\Command;
4
5
use FOS\ElasticaBundle\Configuration\IndexTemplateConfig;
6
7
class ConfigManagerTest extends \PHPUnit_Framework_TestCase
8
{
9
    public function testInstantiate()
10
    {
11
        $name = 'index_template1';
12
        $config = array(
13
            'elasticSearchName' => 'index_template_elastic_name1',
14
            'settings' => array(1),
15
            'template' => 't*',
16
        );
17
        $indexTemplate = new IndexTemplateConfig($name, array(), $config);
18
        $this->assertEquals($name, $indexTemplate->getName());
19
        $this->assertEquals(
20
            $config,
21
            array(
22
                'elasticSearchName' => $indexTemplate->getElasticSearchName(),
23
                'settings' => $indexTemplate->getSettings(),
24
                'template' => $indexTemplate->getTemplate(),
25
            )
26
        );
27
    }
28
29
    /**
30
     * @expectedException \InvalidArgumentException
31
     */
32
    public function testIncorrectInstantiate()
33
    {
34
        $name = 'index_template1';
35
        new IndexTemplateConfig($name, array(), array());
36
    }
37
38
}
39