예제 #1
0
 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());
 }
예제 #2
0
 /**
  * @return mixed|void
  */
 public function generate()
 {
     $value = parent::generate();
     return preg_replace('/\\{n\\}/', $value, $this->string);
 }
예제 #3
0
 public function testGenerateCustomStep()
 {
     $generator = new IntegerSequence(2);
     $this->assertEquals(2, $generator->generate());
     $this->assertEquals(4, $generator->generate());
 }