File tree Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -224,13 +224,14 @@ private function specifyRestoreProperties($properties)
224
224
private function getSpecifyObjectProperties ()
225
225
{
226
226
$ properties = [];
227
+ $ myReflection = new \ReflectionObject ($ this );
227
228
228
- foreach (get_object_vars ( $ this ) as $ property => $ value ) {
229
- if ($ this ->specifyConfig ->propertyIgnored ($ property )) {
229
+ foreach ($ myReflection -> getProperties ( ) as $ property ) {
230
+ if ($ this ->specifyConfig ->propertyIgnored ($ property-> getName () )) {
230
231
continue ;
231
232
}
232
233
233
- $ properties [] = new ObjectProperty ($ this , $ property, $ value );
234
+ $ properties [] = new ObjectProperty ($ this , $ property );
234
235
}
235
236
236
237
// isolate mockObjects property from PHPUnit_Framework_TestCase
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ class SpecifyTest extends \SpecifyUnitTest
4
4
{
5
5
protected $ user ;
6
6
protected $ a ;
7
+ protected $ private = false ;
7
8
8
9
public function testSpecification ()
9
10
{
@@ -227,7 +228,15 @@ function testPropertyRestore()
227
228
['bye ' ],
228
229
['world ' ],
229
230
]]);
231
+
230
232
$ this ->assertEquals (['hello ' , 'world ' ], $ this ->testOne ->prop );
233
+ $ this ->assertFalse ($ this ->private );
234
+
235
+ $ this ->specify ('property $private should be restored properly ' , function () {
236
+ $ this ->private = 'i \'m protected ' ;
237
+ });
238
+
239
+ $ this ->assertFalse ($ this ->private );
231
240
}
232
241
233
242
public function testExamplesIndexInName ()
Original file line number Diff line number Diff line change 3
3
class SpecifyUnitTest extends \PHPUnit_Framework_TestCase
4
4
{
5
5
use Codeception \Specify;
6
+
7
+ private $ private = true ;
6
8
}
You can’t perform that action at this time.
0 commit comments