HttpControllerTestCase   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A replaceService() 0 7 1
A getService() 0 3 1
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 Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
14
15
class HttpControllerTestCase extends AbstractHttpControllerTestCase
16
{
17
    /**
18
     * @param string $name Service name
19
     *
20
     * @return array|mixed|object
21
     */
22
    public function getService($name)
23
    {
24
        return $this->getApplicationServiceLocator()->get($name);
25
    }
26
27
    /**
28
     * @param string $name Service name
29
     * @param array|object $service
30
     */
31
    public function replaceService($name, $service)
32
    {
33
        $serviceManager = $this->getApplicationServiceLocator();
34
35
        $serviceManager->setAllowOverride(true);
36
        $serviceManager->setService($name, $service);
37
        $serviceManager->setAllowOverride(false);
38
    }
39
}