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