public function testConstrainQuery() { $query = m::mock('Illuminate\\Database\\Eloquent\\Builder'); $query->shouldReceive('where')->once(); $this->field->shouldReceive('getOption')->once(); $this->field->constrainQuery($query, m::mock(array()), 'foo'); }
public function testConstrainQueryAlreadyJoined() { $query = m::mock('Illuminate\\Database\\Eloquent\\Builder'); $query->shouldReceive('join')->never()->shouldReceive('where')->once(); $this->validator->shouldReceive('isJoined')->once()->andReturn(true); $model = m::mock(array('getTable' => 'table', 'getKeyName' => 'id')); $this->field->shouldReceive('getOption')->twice(); $this->field->constrainQuery($query, $model, 'foo'); }