| Total Complexity | 7 |
| Total Lines | 31 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 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 | } |
||
| 43 |