naing's avatar
Level 1

test case for HTML Select option spoofing

Hi experts,

My HTML blade for Select:

  @foreach(App\Model\Master\Country::all() as $country)
     <option value='{{$country->id}}'>
        {{$country->name}}
    </option>
 @endforeach

My validatoin rule:

'country' => ['required',new CountryRule],

This will return false if user enters(spoofs) incorrect id in HTML request. I can test it manually by entering incorrect id in the value of the selected option in HTML request.

But I want to create a test case with Dusk. How can I do it?

0 likes
2 replies
tisuchi's avatar

What is new CountryRule?

I have a suggestion for you.

Never call model in your blade. It's not a best practice.

naing's avatar
Level 1

Ah, that is the input validation written in the controller.

Sorry for confusing.

Please or to participate in this conversation.