Completed
Push — master ( 09d055...51cf8d )
by Daryl
04:01
created

TestCase::get_sample_response()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Clubdeuce\WPLib\Components\GoogleMaps\Tests;
4
5
/**
6
 * Class TestCase
7
 * @package Clubdeuce\WPLib\Components\GoogleMaps\Tests
8
 */
9
class TestCase extends \WP_UnitTestCase {
10
11
    /**
12
     * @param $class
13
     * @param $property
14
     * @return mixed
15
     */
16
    public function getReflectionPropertyValue( $class, $property )
17
    {
18
        $reflection = new \ReflectionProperty( $class, $property );
19
        $reflection->setAccessible( true );
20
        return $reflection->getValue( $class );
21
    }
22
23
    /**
24
     * @param $class
25
     * @param $property
26
     * @param $value
27
     */
28
    public function setReflectionPropertyValue( $class, $property, $value )
29
    {
30
        $reflection = new \ReflectionProperty( $class, $property );
31
        $reflection->setAccessible( true );
32
        return $reflection->setValue( $class, $value );
33
    }
34
35
    /**
36
     * @param $class
37
     * @param $method
38
     * @return mixed
39
     */
40
    public function reflectionMethodInvoke( $class, $method )
41
    {
42
        $reflection = new \ReflectionMethod( $class, $method );
43
        $reflection->setAccessible( true );
44
        if (is_string($class)) {
45
            $class = null;
0 ignored issues
show
Coding Style introduced by
Consider using a different name than the parameter $class. This often makes code more readable.
Loading history...
46
        }
47
        return $reflection->invoke( $class );
48
    }
49
50
    /**
51
     * @param $class
52
     * @param $method
53
     * @param $args
54
     * @return mixed
55
     */
56
    public function reflectionMethodInvokeArgs( $class, $method, $args )
57
    {
58
        $reflection = new \ReflectionMethod( $class, $method );
59
        $reflection->setAccessible( true );
60
        if (is_string($class)) {
61
            $class = null;
0 ignored issues
show
Coding Style introduced by
Consider using a different name than the parameter $class. This often makes code more readable.
Loading history...
62
        }
63
        return $reflection->invoke( $class, $args );
64
    }
65
66
	/**
67
	 * @return string
68
	 */
69
    public function get_sample_response() {
70
71
    	return file_get_contents( __DIR__ . '/geocoder-response.json' );
72
73
    }
74
}