コード例 #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
ファイル: StringSequence.php プロジェクト: omerucel/fabrika
 /**
  * @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());
 }