rename currentstock bulk form
This commit is contained in:
parent
ab0677c463
commit
ca0e7d300d
3 changed files with 7 additions and 7 deletions
|
@ -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,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
{
|
{
|
|
@ -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);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue