스텁이 ArrayIterator처럼 작동하도록하려면 어떻게해야합니까? 내 말은,이 스텁을 반복하고 싶다. Practical PHP Testing의 연습 문제입니다.PHPUnit - 스텁 (Stub)이 빌드 유형처럼 작동합니다.
7.2
Write a EvenIterator which takes a FibonacciIterator an iterates only
on the even-indexed values (returning 0, 1, 3, 8, 21...).
7.3
Write tests for the EvenIterator class, stubbing out the
FibonacciIterator using an ArrayIterator in substitution, which is provided
by the Spl (otherwise it will never terminate!)
감사합니다.
FibonacciIterator에 대한 정상적인 호출은 어떤 모양입니까? – Fenton
iterator를 구현합니다. $ a = new FibonacciIterator (7)를 호출합니다. 그 후에는 0, 1, 1, 2, 3, 5, 8을 반복 할 수 있습니다. 고마워요. – thom
작업이 실제로 'FibonacciIterator의 스텁으로 ArrayIterator를 사용한다고'하지 않습니까? – Mchl