phpspec/phpspec — pull request #311 by jon-acker (2014-03-07 11:06:00+00:00)
Title: Implementation idea of Traversable subject

It's tricky, with the current architecture, to add traversebility to to the wrapped object: if I add it as another dependency to the Subject constructor it breaks "expect", which is used to run the behat features (and adding more dependencies isn't great either). In the current implementation it added to SubjectWithArrayAccess by extending the latter, which is not great either, but I can't see any other way it could be added without introducing breaking changes.

I've written a feature which covers the important cases of traversal, and I've also spec'd the TraversableSubject - though there's a problem with the construction of the SUT in the specs which I haven't been able to figure out, and I've therefore disabled them.