Code Duplication    Length = 19-19 lines in 5 locations

Tests/Unit/DependencyInjection/ConfigurationTest.php 5 locations

@@ 332-350 (lines=19) @@
329
        }
330
    }
331
332
    public function testCacheManagerNoClient()
333
    {
334
        $formats = array_map(function ($path) {
335
            return __DIR__.'/../../Resources/Fixtures/'.$path;
336
        }, array(
337
            'config/cachemanager_noclient.yml',
338
            'config/cachemanager_noclient.xml',
339
            'config/cachemanager_noclient.php',
340
        ));
341
342
        foreach ($formats as $format) {
343
            try {
344
                $this->assertProcessedConfigurationEquals(array(), array($format));
345
                $this->fail('No exception thrown on invalid configuration');
346
            } catch (InvalidConfigurationException $e) {
347
                $this->assertContains('need to configure a proxy_client', $e->getMessage());
348
            }
349
        }
350
    }
351
352
    public function testTagsNoCacheManager()
353
    {
@@ 352-370 (lines=19) @@
349
        }
350
    }
351
352
    public function testTagsNoCacheManager()
353
    {
354
        $formats = array_map(function ($path) {
355
            return __DIR__.'/../../Resources/Fixtures/'.$path;
356
        }, array(
357
            'config/tags_nocachemanager.yml',
358
            'config/tags_nocachemanager.xml',
359
            'config/tags_nocachemanager.php',
360
        ));
361
362
        foreach ($formats as $format) {
363
            try {
364
                $this->assertProcessedConfigurationEquals(array(), array($format));
365
                $this->fail('No exception thrown on invalid configuration');
366
            } catch (InvalidConfigurationException $e) {
367
                $this->assertContains('cache_manager needed for tag handling', $e->getMessage());
368
            }
369
        }
370
    }
371
372
    public function testInvalidationNoCacheManager()
373
    {
@@ 372-390 (lines=19) @@
369
        }
370
    }
371
372
    public function testInvalidationNoCacheManager()
373
    {
374
        $formats = array_map(function ($path) {
375
            return __DIR__.'/../../Resources/Fixtures/'.$path;
376
        }, array(
377
            'config/invalidation_nocachemanager.yml',
378
            'config/invalidation_nocachemanager.xml',
379
            'config/invalidation_nocachemanager.php',
380
        ));
381
382
        foreach ($formats as $format) {
383
            try {
384
                $this->assertProcessedConfigurationEquals(array(), array($format));
385
                $this->fail('No exception thrown on invalid configuration');
386
            } catch (InvalidConfigurationException $e) {
387
                $this->assertContains('cache_manager needed for invalidation handling', $e->getMessage());
388
            }
389
        }
390
    }
391
392
    public function testInvalidDate()
393
    {
@@ 392-410 (lines=19) @@
389
        }
390
    }
391
392
    public function testInvalidDate()
393
    {
394
        $formats = array_map(function ($path) {
395
            return __DIR__.'/../../Resources/Fixtures/'.$path;
396
        }, array(
397
            'config/invalid_date.yml',
398
            'config/invalid_date.xml',
399
            'config/invalid_date.php',
400
        ));
401
402
        foreach ($formats as $format) {
403
            try {
404
                $this->assertProcessedConfigurationEquals(array(), array($format));
405
                $this->fail('No exception thrown on invalid configuration');
406
            } catch (InvalidConfigurationException $e) {
407
                $this->assertContains('Failed to parse time string', $e->getMessage());
408
            }
409
        }
410
    }
411
412
    /**
413
     * The configuration is reused, we only need to test this once.
@@ 415-433 (lines=19) @@
412
    /**
413
     * The configuration is reused, we only need to test this once.
414
     */
415
    public function testRulesBothStatusAndExpression()
416
    {
417
        $formats = array_map(function ($path) {
418
            return __DIR__.'/../../Resources/Fixtures/'.$path;
419
        }, array(
420
            'config/rules_matchstatusandexpression.yml',
421
            'config/rules_matchstatusandexpression.xml',
422
            'config/rules_matchstatusandexpression.php',
423
        ));
424
425
        foreach ($formats as $format) {
426
            try {
427
                $this->assertProcessedConfigurationEquals(array(), array($format));
428
                $this->fail('No exception thrown on invalid configuration');
429
            } catch (InvalidConfigurationException $e) {
430
                $this->assertContains('may not set both additional_cacheable_status and match_response', $e->getMessage());
431
            }
432
        }
433
    }
434
435
    /**
436
     * @return array The configuration when nothing is specified.