I have a model that overloads the where
function.
My overloaded method looks like this:
public function where($column, $operator = null, $value = null, $boolean = 'and')
{
if (in_array($column, $this->metaFields))
{
$value = '%"' . $column . '":"' . $value . '"';
$column = 'meta';
$operator = 'like';
}
return parent::where($column, $operator, $value, $boolean);
}
Now using phpunit and mockery I am trying to test this class, I need to test my overloaded where function, all I really care about is what the values are that get passed to parent::where()
My question is, is it possible/how would I mock the parent class so I can do
$metaField = 'colour';
$value = 'blue';
//on the parent
->shouldReceive('where')->with(['meta', 'like', '%"colour":"blue"%'])->once();
//on the model I am testing
$model->where('colour', 'blue');