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

MongoTestCase   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 16 1
1
<?php
2
3
namespace Pouzor\MongoDBBundle\Tests;
4
5
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
6
use Pouzor\MongoDBBundle\Tests\App\AppKernel;
7
use Pouzor\MongoDBBundle\DocumentManager\DocumentManager;
8
use Psr\Log\NullLogger;
9
10
class MongoTestCase extends WebTestCase
11
{
12
13
    public $testRepo;
14
    public $manager;
15
    public $k;
16
    public $container = null;
17
18
    private $config = [
19
        "db" => "mongodbbundle",
20
        "host" => "localhost",
21
        "port" => "27017",
22
        "username" => null,
23
        "password" => null,
24
        "schema" => ['Foo' => ['indexes' => ["bar" => -1]]],
25
        "options" => []
26
    ];
27
28
    /**
29
     * Setup the test class
30
     */
31
    public function setUp()
32
    {
33
34
        $this->k = new AppKernel('test', true);
35
        $this->k->boot();
36
        $this->container = $this->k->getContainer();
37
38
        $logger = new NullLogger();
39
        $this->manager = new DocumentManager($this->config, $logger);
40
41
42
        $this->testRepo = $this->manager->getRepository('Foo');
43
        $this->testRepo->deleteMany([], []);
44
        $this->testRepo->dropIndexes();
45
46
    }
47
48
}
49