ResetMocks.php 361 B

1234567891011121314
  1. <?php
  2. trait ResetMocks
  3. {
  4. protected function resetMockObjects()
  5. {
  6. $refl = new ReflectionObject($this);
  7. while (!$refl->hasProperty('mockObjects')) {
  8. $refl = $refl->getParentClass();
  9. }
  10. $prop = $refl->getProperty('mockObjects');
  11. $prop->setAccessible(true);
  12. $prop->setValue($this, array());
  13. }
  14. }