Completed
Pull Request — master (#105)
by
unknown
02:01
created

SampleFakeManagerRequestFilter   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2
Metric Value
wmc 6
lcom 0
cbo 2
dl 0
loc 17
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
B preRequest() 0 11 5
A postRequest() 0 2 1
1
<?php
2
/**
3
 * Registers fake web services which are connected to a temporary database.
4
 * The registration is for the lifetime of the current request only,
5
 * but the database can persist beyond that, and share state with other
6
 * web requests as well as Behat CLI execution.
7
 *
8
 * The database is reset through..TBC
9
 */
10
class SampleFakeManagerRequestFilter {
11
12
    public function preRequest($req, $session, $model) {
0 ignored issues
show
Unused Code introduced by
The parameter $req is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $session is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $model is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
13
        if(class_exists('TestSessionEnvironment')) {
14
            // Set in App\Test\Behaviour\FeatureContext
15
            $testState = Injector::inst()->get('TestSessionEnvironment')->getState();
16
17
            if($testState && isset($testState->fakeDatabasePath) && $testState->fakeDatabasePath) {
18
                $fakeDb = new FakeDatabase($testState->fakeDatabasePath);
19
                Injector::inst()->get('SampleFakeManager', false, array($fakeDb));
20
            }
21
        }
22
    }
23
24
    public function postRequest() {
25
    }
26
}