Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions database/factories/ProductFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ public function definition(): array
*/
protected function generateFeatures(): array
{
// The admin's shape: one bullet per line of the pricing card.
return [
'storage_gb' => fake()->randomElement([5, 10, 50, 100, 500, 1000]),
'max_users' => fake()->randomElement([1, 5, 10, 25, 50, 100]),
'support' => fake()->randomElement(['community', 'email', 'priority', '24/7']),
'api_calls_per_month' => fake()->randomElement([1000, 10000, 100000, 'unlimited']),
fake()->randomElement([5, 10, 50, 100, 500, 1000]).' GB storage',
'Up to '.fake()->randomElement([1, 5, 10, 25, 50, 100]).' users',
fake()->randomElement(['Community', 'Email', 'Priority', '24/7']).' support',
fake()->randomElement(['1k', '10k', '100k', 'Unlimited']).' API calls / month',
];
}

Expand Down
10 changes: 10 additions & 0 deletions tests/Feature/ProductFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,14 @@
$this->assertSame(500, Product::query()->distinct()->count('slug'));
$this->assertSame(500, Product::query()->distinct()->count('sku'));
}

/** The admin edits `features` as a list of bullets: Filament 5.12.2 refuses a factory row of numbers keyed by name. */

Check warning on line 22 in tests/Feature/ProductFactoryTest.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Split this 123 characters long line (which is greater than 120 authorized).

See more on https://sonarcloud.io/project/issues?id=saucebase-dev_billing&issues=AaItY5I4hE9oDkEawdB9&open=AaItY5I4hE9oDkEawdB9&pullRequest=45
public function test_features_are_the_bullets_the_admin_form_edits(): void
{
$features = Product::factory()->make()->features;

$this->assertIsList($features);
$this->assertNotEmpty($features);
$this->assertContainsOnlyString($features);
}
}