mercredi 30 septembre 2015

Unit testing with [Laravel 5]

I would appreciate if someone can show me how can I test this method inside my controller:

class CommentController extends Controller {

    protected $update;

    function __construct(Comment $update) {
        $this->update = $update;
    }
    /**
     * Update the specified resource in storage.
     *
     * @param  int  $id
     * @return Response
     */
    public function update(UpdateCommentRequest $request) {
        if (Input::get('task') == 'updateComment') {
            if ($this->update->find(Input::get('id'))
                            ->update(['text' => $request->get('text')])) {
                return json_encode(array('success' => true));
            }
        }
    }

This is update route: /api/project/

Aucun commentaire:

Enregistrer un commentaire