Code Duplication    Length = 19-19 lines in 5 locations

Tests/Unit/DependencyInjection/ConfigurationTest.php 5 locations

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