I'm currently working with Symfony2 and I'm testing my project with PHPUnit.
I want to test an exception when a form is submitted with the wrong parameters or the URL isn't complete.

I went trough the documentation of Symfony2 and PHPUnit but didn't find any class/method to do so.

How can I change the value of a form's action? I want to use PHPUnit so the report created is up to date and I can see the coverage of my code.

**EDIT:**

To clarify my question, some new content.
How do I test the line starting with '>' in my controller? (`throw $this->createNotFoundException('Unable to find ParkingZone entity.');`)

When the user modifies the action link, in the controller the process will go trough the exception (or error message, if this action is chosen). How can I test this case?

***Controller***

```
/**
 * Edits an existing ParkingZone entity.
 *
 * @Route("/{id}/update", name="parkingzone_update")
 * @Method("post")
 * @Template("RatpGarageL1Bundle:ParkingZone:edit.html.twig")
 */
public function updateAction($id)
{
    $em = $this->getDoctrine()->getEntityManager();

    $entity = $em->getRepository('RatpGarageL1Bundle:ParkingZone')->find($id);

    if (!$entity) {
>        throw $this->createNotFoundException('Unable to find ParkingZone entity.');
    }

    $editForm   = $this->createForm(new ParkingZoneType(), $entity);
    $deleteForm = $this->createDeleteForm($id);

    $request = $this->getRequest();

    $editForm->bindRequest($request);

    if ($editForm->isValid()) {
        $em->persist($entity);
        $em->flush();

        return $this->redirect($this->generateUrl('parkingzone_edit', array('id' => $id)));
    }

    return array(
        'entity'      => $entity,
        'edit_form'   => $editForm->createView(),
        'delete_form' => $deleteForm->createView(),
    );
}

```

***View:***

```
<form action="{{ path('parkingzone_update', { 'id': entity.id }) }}" method="post" {{ form_enctype(form) }}>
    <div class="control-group">
        {{ form_label(form.name, 'Name', { 'attr': {'class': 'control-label'} } ) }}
        <div class="controls error">
            {{ form_widget(form.name, { 'attr': {'class': ''} } ) }}
            <span class="help-inline">{{ form_errors(form.name) }}</span>
        </div>
    </div>
    <div class="control-group">
        {{ form_label(form.orderSequence, 'Rang', { 'attr': {'class': 'control-label'} } ) }}
        <div class="controls error">
            {{ form_widget(form.orderSequence, { 'attr': {'class': ''} } ) }}
            <span class="help-inline">{{ form_errors(form.orderSequence) }}</span>
        </div>
    </div>
    <div class="control-group">
        {{ form_label(form.image, 'Image', { 'attr': {'class': 'control-label'} } ) }}
        <div class="controls error">
            {{ form_widget(form.image, { 'attr': {'class': ''} } ) }}
            <span class="help-inline">{{ form_errors(form.image) }}</span>
        </div>
    </div>
    {{ form_rest(form) }}
    <div class="form-actions">
        <button type="submit" class="btn btn-primary">Enregistrer</button>
        <a href="{{ path('parkingzone') }}" class="btn">Annuler</a>
    </div>
</form>

```