Completed
Push — master ( f1e1ae...7e3292 )
by Denis
10:20 queued 02:02
created

BundleTest   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 7
eloc 15
dl 0
loc 31
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Artprima\PrometheusMetricsBundle\Tests;
4
5
use Symfony\Bundle\FrameworkBundle\Tests\Functional\WebTestCase;
6
7
/**
8
 * @group functional
9
 */
10
class BundleTest extends WebTestCase
11
{
12
    protected static function getKernelClass()
13
    {
14
        require_once __DIR__.'/Fixtures/App/AppKernel.php';
15
16
        return 'Tests\Artprima\PrometheusMetricsBundle\Fixtures\App\AppKernel';
17
    }
18
19
    protected static function createKernel(array $options = array())
20
    {
21
        $class = self::getKernelClass();
22
23
        if (!isset($options['test_case'])) {
24
            throw new \InvalidArgumentException('The option "test_case" must be set.');
25
        }
26
27
        return new $class(
28
            static::getVarDir(),
29
            $options['test_case'],
30
            isset($options['root_config']) ? $options['root_config'] : 'config.yml',
31
            isset($options['environment']) ? $options['environment'] : strtolower(static::getVarDir().$options['test_case']),
32
            isset($options['debug']) ? $options['debug'] : true
33
        );
34
    }
35
36
    public function testBundle()
37
    {
38
        $client = $this->createClient(array('test_case' => 'PrometheusMetricsBundle', 'root_config' => 'config.yml'));
39
        $client->request('GET', '/metrics/prometheus');
40
        $this->assertContains('myapp_instance_name{instance="dev"} 1', $client->getResponse()->getContent());
41
    }
42
}
43