1 | <?php |
||
2 | |||
3 | namespace Signify\Tests; |
||
4 | |||
5 | use SilverStripe\Core\Config\Config; |
||
6 | |||
7 | abstract class TestUtils |
||
8 | { |
||
9 | |||
10 | /** |
||
11 | * Perform a test with some specific configuration which should not affect other tests. |
||
12 | * |
||
13 | * @param array $configMap |
||
14 | * @param Callable $testCallback |
||
15 | */ |
||
16 | public static function testWithConfig($configMap, $testCallback) |
||
17 | { |
||
18 | $originalConfigValues = array(); |
||
19 | // Set new config values. |
||
20 | foreach ($configMap as $class => $config) { |
||
21 | foreach ($config as $key => $value) { |
||
22 | $originalConfigValues[$class][$key] = Config::inst()->get($class, $key); |
||
23 | Config::inst()->update($class, $key, $value); |
||
0 ignored issues
–
show
|
|||
24 | } |
||
25 | } |
||
26 | |||
27 | // Perform test with specific configuration. |
||
28 | $testCallback(); |
||
29 | |||
30 | // Restore original config values. |
||
31 | foreach ($originalConfigValues as $class => $config) { |
||
32 | foreach ($config as $key => $value) { |
||
33 | Config::inst()->update($class, $key, $value); |
||
34 | } |
||
35 | } |
||
36 | } |
||
37 | |||
38 | public static function arrayChangeKeyCaseDeep(array $input, $case = null) |
||
39 | { |
||
40 | foreach ($input as $header => &$value) { |
||
41 | if (is_array($value)) { |
||
42 | $value = self::arrayChangeKeyCaseDeep($value, $case); |
||
43 | } |
||
44 | } |
||
45 | return array_change_key_case($input, $case); |
||
46 | } |
||
47 | } |
||
48 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.