예제 #1
0
 public function testGenerateUniqueIdentifierSeemsUnique()
 {
     $all = [];
     for ($i = 0; $i < 1000; $i++) {
         $all[] = BaseModels::generateUniqueIdentifier();
     }
     $onlyUnique = array_unique($all);
     $this->assertEquals(count($all), count($onlyUnique));
 }
예제 #2
0
 protected function beforeValidationOnCreate()
 {
     $this->identifier = self::generateUniqueIdentifier(20);
     parent::beforeValidationOnCreate();
 }