rename currentstock bulk form

This commit is contained in:
lubiana 2025-06-14 18:38:17 +02:00
parent ab0677c463
commit ca0e7d300d
Signed by: lubiana
SSH key fingerprint: SHA256:vW1EA0fRR3Fw+dD/sM0K+x3Il2gSry6YRYHqOeQwrfk
3 changed files with 7 additions and 7 deletions

View file

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace App\Controller; namespace App\Controller;
use App\Form\BulkEditDrinkTypeStockForm; use App\Form\BulkEditDrinkTypeCurrentStockForm;
use App\Form\BulkEditDrinkTypeWantedStockForm; use App\Form\BulkEditDrinkTypeWantedStockForm;
use App\Repository\DrinkTypeRepository; use App\Repository\DrinkTypeRepository;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
@ -24,7 +24,7 @@ final class DrinkTypeBulkController extends AbstractController
): Response { ): Response {
$drinkTypes = $drinkTypeRepository->findAll(); $drinkTypes = $drinkTypeRepository->findAll();
$form = $this->createForm(BulkEditDrinkTypeStockForm::class, [ $form = $this->createForm(BulkEditDrinkTypeCurrentStockForm::class, [
'drinkTypes' => $drinkTypes, 'drinkTypes' => $drinkTypes,
]); ]);

View file

@ -10,7 +10,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
class BulkEditDrinkTypeStockForm extends AbstractType class BulkEditDrinkTypeCurrentStockForm extends AbstractType
{ {
public function buildForm(FormBuilderInterface $builder, array $options): void public function buildForm(FormBuilderInterface $builder, array $options): void
{ {

View file

@ -75,8 +75,8 @@ test('Bulk Edit Form submission updates drink type current stock levels', functi
// Update the current stock values - note: drink types are ordered by wantedStock DESC // Update the current stock values - note: drink types are ordered by wantedStock DESC
// So Beer (wantedStock 20) comes first [0], Cola (wantedStock 10) comes second [1] // So Beer (wantedStock 20) comes first [0], Cola (wantedStock 10) comes second [1]
$form['bulk_edit_drink_type_stock_form[drinkTypes][0][currentStock]'] = 25; // Beer $form['bulk_edit_drink_type_current_stock_form[drinkTypes][0][currentStock]'] = 25; // Beer
$form['bulk_edit_drink_type_stock_form[drinkTypes][1][currentStock]'] = 15; // Cola $form['bulk_edit_drink_type_current_stock_form[drinkTypes][1][currentStock]'] = 15; // Cola
$client->submit($form); $client->submit($form);
@ -149,7 +149,7 @@ test('Bulk Edit Form rejects negative values (validation)', function (): void {
// Submit the form with negative value // Submit the form with negative value
$form = $crawler->selectButton('Update Current Stock Levels')->form(); $form = $crawler->selectButton('Update Current Stock Levels')->form();
$form['bulk_edit_drink_type_stock_form[drinkTypes][0][currentStock]'] = -5; $form['bulk_edit_drink_type_current_stock_form[drinkTypes][0][currentStock]'] = -5;
$client->submit($form); $client->submit($form);
@ -189,7 +189,7 @@ test('Bulk Edit Form preserves drink type names as read-only', function (): void
// Submit the form // Submit the form
$form = $crawler->selectButton('Update Current Stock Levels')->form(); $form = $crawler->selectButton('Update Current Stock Levels')->form();
$form['bulk_edit_drink_type_stock_form[drinkTypes][0][currentStock]'] = 15; $form['bulk_edit_drink_type_current_stock_form[drinkTypes][0][currentStock]'] = 15;
$client->submit($form); $client->submit($form);