7
7
use Prophecy \Prophet ;
8
8
use Prophecy \Prophecy \ProphecyInterface ;
9
9
use Prophecy \Exception \Prediction \AggregateException ;
10
+ use ReflectionProperty ;
10
11
11
12
/**
12
13
* A Prophet for built-in PHP functions.
@@ -38,7 +39,7 @@ final class PHPProphet
38
39
* @var Prophet The prophet.
39
40
*/
40
41
private $ prophet ;
41
-
42
+
42
43
/**
43
44
* Builds the prophet.
44
45
*
@@ -49,12 +50,12 @@ public function __construct(Prophet $prophet = null)
49
50
if (is_null ($ prophet )) {
50
51
$ prophet = new Prophet ();
51
52
}
52
-
53
+
53
54
$ revealer = new ReferencePreservingRevealer (self ::getProperty ($ prophet , "revealer " ));
54
55
$ util = self ::getProperty ($ prophet , "util " );
55
56
$ this ->prophet = new Prophet ($ prophet ->getDoubler (), $ revealer , $ util );
56
57
}
57
-
58
+
58
59
/**
59
60
* Creates a new function prophecy for a given namespace.
60
61
*
@@ -66,7 +67,7 @@ public function prophesize($namespace)
66
67
{
67
68
return new FunctionProphecy ($ namespace , $ this ->prophet );
68
69
}
69
-
70
+
70
71
/**
71
72
* Checks all predictions defined by prophecies of this Prophet.
72
73
*
@@ -80,7 +81,7 @@ public function checkPredictions()
80
81
Mock::disableAll ();
81
82
$ this ->prophet ->checkPredictions ();
82
83
}
83
-
84
+
84
85
/**
85
86
* Defines the function prophecy in the given namespace.
86
87
*
@@ -109,7 +110,7 @@ public static function define($namespace, $name)
109
110
->build ()
110
111
->define ();
111
112
}
112
-
113
+
113
114
/**
114
115
* Returns a private property of a prophet.
115
116
*
@@ -120,7 +121,7 @@ public static function define($namespace, $name)
120
121
*/
121
122
private static function getProperty (Prophet $ prophet , $ property )
122
123
{
123
- $ reflection = new \ ReflectionProperty ($ prophet , $ property );
124
+ $ reflection = new ReflectionProperty ($ prophet , $ property );
124
125
$ reflection ->setAccessible (true );
125
126
return $ reflection ->getValue ($ prophet );
126
127
}
0 commit comments