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

ConfigManagerTest::testIncorrectInstantiate()   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 0
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