That is no method createplan
There is a method create in the plan controller.
That one looks like this :
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
return View::make('plan.create');
}
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$validation = Validator::make(Input::all(), Plan::$rules);
if ($validation-> fails())
{
Return Redirect::back()->WithInput()->WithErrors($validation->messages());
}
$abonnementen = New Plan;
$abonnementen->soort = Input::get('soort');
$abonnementen->bedrag = Input::get('bedrag');
$abonnementen->save();
Redirect::route('home.dashboard' );
}
The problem @malfait.robin is trying to point out that you call createPlan() on this line: $plan = $t->createPlan();. In order to call that method or function or whatever you want to name it you have to create that function and for us to help you we need to see that function.
You create a plan and perform a test on that plan, so you do you create that plan?
--- In Dutch ---
Het probleem dat @malfait.robin probeert duidelijk te maken is dat je de functie createPlan() op deze regel: $plan = $t->createPlan(); probeert uit te voeren. Maar hoe ziet die functie er uit? Het is geen standaard functie, dus je moet hem zelf hebben geschreven of gemaakt. Ofwel hoe ziet die functie er uit?
(createPlan is a magic function provided by codeception so it should be creating an instance of the model class: Plan)
First of all you have a fundamental mistake: You're using Validator class in your controller to do the validation but you're testing the validate method of the model class.
Validator::make(Input::all(), Plan::$rules)
Either test the controller class for validation and not the model for this case, or implement the validate method inside the model class and use that in the controller too. Example validate method would be smt. like this:
public function validate($data)
{
$v = Validator::make($data, self::$rules);
return $v->passes();
}