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)
224224 private function getSpecifyObjectProperties ()
225225 {
226226 $ properties = [];
227+ $ myReflection = new \ReflectionObject ($ this );
227228
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 () )) {
230231 continue ;
231232 }
232233
233- $ properties [] = new ObjectProperty ($ this , $ property, $ value );
234+ $ properties [] = new ObjectProperty ($ this , $ property );
234235 }
235236
236237 // 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
44{
55 protected $ user ;
66 protected $ a ;
7+ protected $ private = false ;
78
89 public function testSpecification ()
910 {
@@ -227,7 +228,15 @@ function testPropertyRestore()
227228 ['bye ' ],
228229 ['world ' ],
229230 ]]);
231+
230232 $ 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 );
231240 }
232241
233242 public function testExamplesIndexInName ()
Original file line number Diff line number Diff line change 33class SpecifyUnitTest extends \PHPUnit_Framework_TestCase
44{
55 use Codeception \Specify;
6+
7+ private $ private = true ;
68}
You can’t perform that action at this time.
0 commit comments