mirror of
https://gh.wpcy.net/https://github.com/fairpm/aspirecloud.git
synced 2026-06-20 02:22:28 +08:00
Add typo3() state to PackageReleaseFactory that sets requires with typo3 version (11.5/12.4/13.4) and PHP 8.1+. Use it in the TYPO3 extension seeder for realistic test data. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Joost de Valk <joost@altha.nl>
50 lines
1.4 KiB
PHP
50 lines
1.4 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Package;
|
|
use App\Models\PackageRelease;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/** @extends Factory<PackageRelease> */
|
|
class PackageReleaseFactory extends Factory
|
|
{
|
|
protected $model = PackageRelease::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'id' => $this->faker->uuid(),
|
|
'version' => $this->faker->semver(),
|
|
'download_url' => $this->faker->url(),
|
|
'requires' => [
|
|
'php' => $this->faker->randomElement(['8.0', '8.1', '8.2', '8.3']),
|
|
],
|
|
'suggests' => [
|
|
'another-plugin' => $this->faker->semver(),
|
|
],
|
|
'provides' => [
|
|
'some-feature' => $this->faker->semver(),
|
|
],
|
|
'artifacts' => [
|
|
'package' => [
|
|
[
|
|
'url' => $this->faker->url(),
|
|
'type' => 'zip',
|
|
],
|
|
],
|
|
],
|
|
];
|
|
}
|
|
|
|
public function typo3(): static
|
|
{
|
|
return $this->state(fn () => [
|
|
'requires' => [
|
|
'typo3' => $this->faker->randomElement(['11.5', '12.4', '13.4']),
|
|
'php' => $this->faker->randomElement(['8.1', '8.2', '8.3', '8.4']),
|
|
],
|
|
]);
|
|
}
|
|
}
|