@@ -84,6 +84,8 @@ protected function setUp()
84
84
->getMock ()
85
85
));
86
86
87
+ $ this ->mockFeatureSet = $ this ->getMockBuilder ('Zend\Db\TableGateway\Feature\FeatureSet ' )->getMock ();
88
+
87
89
$ this ->table = $ this ->getMockForAbstractClass (
88
90
'Zend\Db\TableGateway\AbstractTableGateway '
89
91
//array('getTable')
@@ -104,6 +106,9 @@ protected function setUp()
104
106
case 'sql ' :
105
107
$ tgPropReflection ->setValue ($ this ->table , $ this ->mockSql );
106
108
break ;
109
+ case 'featureSet ' :
110
+ $ tgPropReflection ->setValue ($ this ->table , $ this ->mockFeatureSet );
111
+ break ;
107
112
}
108
113
}
109
114
}
@@ -369,6 +374,30 @@ public function testGetLastInsertValue()
369
374
self ::assertEquals (10 , $ this ->table ->getLastInsertValue ());
370
375
}
371
376
377
+ public function testInitializeBuildsAResultSet ()
378
+ {
379
+ $ stub = $ this ->getMockForAbstractClass (AbstractTableGateway::class);
380
+
381
+ $ tgReflection = new \ReflectionClass ('Zend\Db\TableGateway\AbstractTableGateway ' );
382
+ foreach ($ tgReflection ->getProperties () as $ tgPropReflection ) {
383
+ $ tgPropReflection ->setAccessible (true );
384
+ switch ($ tgPropReflection ->getName ()) {
385
+ case 'table ' :
386
+ $ tgPropReflection ->setValue ($ stub , 'foo ' );
387
+ break ;
388
+ case 'adapter ' :
389
+ $ tgPropReflection ->setValue ($ stub , $ this ->mockAdapter );
390
+ break ;
391
+ case 'featureSet ' :
392
+ $ tgPropReflection ->setValue ($ stub , $ this ->mockFeatureSet );
393
+ break ;
394
+ }
395
+ }
396
+
397
+ $ stub ->initialize ();
398
+ $ this ->assertInstanceOf (ResultSet::class, $ stub ->getResultSetPrototype ());
399
+ }
400
+
372
401
/**
373
402
* @covers \Zend\Db\TableGateway\AbstractTableGateway::__get
374
403
*/
0 commit comments