Completed
Push — master ( 3db674...2e3aab )
by Remy
03:46
created

BuildIndexesCommandTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 5
dl 0
loc 32
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B testExecute() 0 29 3
1
<?php
2
3
namespace Pouzor\MongoDBBundle\Tests\Functional\Command;
4
5
use Pouzor\MongoDBBundle\Command\BuildIndexesCommand;
6
use Pouzor\MongoDBBundle\Tests\MongoTestCase;
7
use Symfony\Bundle\FrameworkBundle\Console\Application;
8
use Symfony\Component\Console\Tester\CommandTester;
9
10
class BuildIndexesCommandTest extends MongoTestCase {
11
12
    public function testExecute() {
13
14
        $command = new BuildIndexesCommand();
15
        $command->setManager($this->manager);
16
17
        $indexes = $this->testRepo->listIndexes();
18
        $base = ['_id_'];
19
        foreach ($indexes as $i) {
20
            $this->assertContains($i['name'], $base);
21
        }
22
23
        $app = new Application($this->k);
24
25
        $app->add($command);
26
27
        $tester = new CommandTester($command);
28
29
        $tester->execute(array(
30
            '-vvv' => null,
31
        ));
32
33
        $indexes = $this->testRepo->listIndexes();
34
        $base = ['_id_', 'bar_-1'];
35
36
        foreach ($indexes as $i) {
37
            $this->assertContains($i['name'], $base);
38
        }
39
40
    }
41
}