152 - Give factories unique values for constrained columns
This commit is contained in:
parent
de42bdca38
commit
e58badf70e
4 changed files with 7 additions and 5 deletions
|
|
@ -17,7 +17,7 @@ public function definition(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => $this->faker->words(3, true),
|
'name' => $this->faker->words(3, true),
|
||||||
'url' => $this->faker->url(),
|
'url' => $this->faker->unique()->url(),
|
||||||
'type' => $this->faker->randomElement(['website', 'rss']),
|
'type' => $this->faker->randomElement(['website', 'rss']),
|
||||||
'provider' => $this->faker->randomElement(['vrt', 'belga']),
|
'provider' => $this->faker->randomElement(['vrt', 'belga']),
|
||||||
'language_id' => null,
|
'language_id' => null,
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,9 @@ class LanguageFactory extends Factory
|
||||||
public function definition(): array
|
public function definition(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'short_code' => $this->faker->unique()->languageCode(),
|
// Not a real language code: tests hardcode 'en', 'fr', 'nl' and
|
||||||
|
// others, and faker's pool would collide with them.
|
||||||
|
'short_code' => 'x-'.$this->faker->unique()->numerify('####'),
|
||||||
'name' => $this->faker->unique()->word(),
|
'name' => $this->faker->unique()->word(),
|
||||||
'native_name' => $this->faker->optional()->word(),
|
'native_name' => $this->faker->optional()->word(),
|
||||||
'is_active' => true,
|
'is_active' => true,
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ public function definition(): array
|
||||||
return [
|
return [
|
||||||
'platform' => PlatformEnum::LEMMY,
|
'platform' => PlatformEnum::LEMMY,
|
||||||
'instance_url' => 'https://lemmy.'.$this->faker->domainName(),
|
'instance_url' => 'https://lemmy.'.$this->faker->domainName(),
|
||||||
'username' => $this->faker->userName(),
|
'username' => $this->faker->unique()->userName(),
|
||||||
'password' => 'test-password',
|
'password' => 'test-password',
|
||||||
'settings' => [],
|
'settings' => [],
|
||||||
'is_active' => true,
|
'is_active' => true,
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ public function definition(): array
|
||||||
return [
|
return [
|
||||||
'platform' => 'lemmy',
|
'platform' => 'lemmy',
|
||||||
'name' => $this->faker->words(2, true),
|
'name' => $this->faker->words(2, true),
|
||||||
'url' => $this->faker->url(),
|
'url' => $this->faker->unique()->url(),
|
||||||
'is_active' => true,
|
'is_active' => true,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
@ -34,7 +34,7 @@ public function lemmy(): static
|
||||||
return $this->state(fn (array $attributes) => [
|
return $this->state(fn (array $attributes) => [
|
||||||
'platform' => 'lemmy',
|
'platform' => 'lemmy',
|
||||||
'name' => 'Lemmy '.$this->faker->word(),
|
'name' => 'Lemmy '.$this->faker->word(),
|
||||||
'url' => 'https://lemmy.'.$this->faker->domainName(),
|
'url' => 'https://lemmy.'.$this->faker->unique()->domainName(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue