Ejemplo n.º 1
0
 public function execute()
 {
     $s = new Stringizer($this->repeatNum);
     if ($s->isNumber() && $this->repeatNum > 0) {
         $value = "";
         for ($i = 0; $i < $this->repeatNum; $i++) {
             $value .= $this->getValue();
         }
         return $value;
     } else {
         // Do nothing just return the same value
         return $this->getValue();
     }
 }
Ejemplo n.º 2
0
 public function testValidNumericRandom()
 {
     // Default is size 10
     $s = new Stringizer("");
     $randomNum1 = $s->randomNumeric()->getString();
     // Default is size 10
     $this->assertEquals(10, $s->length());
     // Confirm is Number, this potentially can fail because
     // a value with zero up front would make the value a string
     //$this->assertEquals(true, $s->isNumber());
     $s2 = new Stringizer(intval($s->getString()));
     $this->assertEquals(true, $s2->isNumber());
     $randonNum2 = $s->randomNumeric()->getString();
     $this->assertNotEquals($randomNum1, $randonNum2);
     // Test non default size
     $s->randomNumeric(20)->getString();
     $this->assertEquals(20, $s->length());
 }
Ejemplo n.º 3
0
 public function testInValidAlphaHasMultiByte()
 {
     $s = new Stringizer("こんにちは");
     $this->assertEquals(false, $s->isNumber());
 }