public function testOnIncrementCounter() { $generator = new IntegerSequence(); $this->assertEquals(1, $generator->generate()); $generator->onIncrementCounter(); $this->assertEquals(3, $generator->generate()); $generator->onIncrementCounter(5); $this->assertEquals(9, $generator->generate()); $generator->onIncrementCounter(-10); $this->assertEquals(10, $generator->generate()); }
/** * @return mixed|void */ public function generate() { $value = parent::generate(); return preg_replace('/\\{n\\}/', $value, $this->string); }
public function testGenerateCustomStep() { $generator = new IntegerSequence(2); $this->assertEquals(2, $generator->generate()); $this->assertEquals(4, $generator->generate()); }