I am trying to create a unit test where I need to simulate form data sent via post. Is there a way to mock POST data?
I've created a class that determines which button was pressed in a way that is independent on its value property. Buttons are placed in a specific button array in the post data (this array only exists if a button was pressed). The pressed button then gets picked up from the request object, and will sometimes be used to determine program flow.
In one of my attempts I created a mock Request object (which I set in the DI) where I override the three methods this test needs: "isPost", "has", and "get".
This way i can control the Request object. What I would like, though, is to control the form values or more specifically I want to change which button is pressed to see how my class behaves in different situations.
Is there a way to do this?