from how i read the code, you need the ->getRows() call which give you an iterator wrapping the raw query result rows at no big extra costs and has the count on it. arguably its a bit stupid that the PHPCR QueryResultInterface is not also countable, but that won't change too quickly. so the previous code was probably correct.

i am a bit surprised why the tests do not reveil this issue. are we mocking too much or the wrong thing?