HttpControllerTestCaseFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 14 2
1
<?php
2
/*
3
 * This file is part of the Noiselabs ZfTestCase Behat Extension.
4
 *
5
 * (c) Vítor Brandão <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Noiselabs\Behat\ZfTestCaseExtension\TestCase;
12
13
use RuntimeException;
14
15
class HttpControllerTestCaseFactory
16
{
17
    /**
18
     * @param string $applicationConfigPath
19
     *
20
     * @return HttpControllerTestCase
21
     */
22
    public static function create($applicationConfigPath)
23
    {
24
        if (!file_exists($applicationConfigPath)) {
25
            throw new RuntimeException(sprintf("Invalid path to ZF application config: '%s'", $applicationConfigPath));
26
        }
27
28
        $applicationConfig = require_once $applicationConfigPath;
29
30
        $testCase = new HttpControllerTestCase();
31
        $testCase->reset();
32
        $testCase->setApplicationConfig($applicationConfig);
33
34
35
        return $testCase;
36
    }
37
}