public function testDifferentInitialNumber() { $number = new FibonacciNumber(10, 20); $this->assertSame(10, $number->getCurrent()); $this->assertSame(30, $number->getNext()->getCurrent()); $this->assertSame(40, $number->getNext()->getNext()->getCurrent()); $this->assertSame(70, $number->getNext()->getNext()->getNext()->getCurrent()); $this->assertSame(110, $number->getNext()->getNext()->getNext()->getNext()->getCurrent()); }
public function next() { ++$this->key; $this->number = $this->number->getNext(); }