public function testSetModelRelationshipSingleValueAutocomplete() { $model = m::mock('Illuminate\\Database\\Eloquent\\Model')->makePartial(); $relatedModel1 = m::mock('Illuminate\\Database\\Eloquent\\Model')->makePartial(); $relatedModel1->shouldReceive('getKeyName')->once()->andReturn('id'); $relatedModel1->id = 1; $relatedModel1->name = 'model_1'; $field = m::mock('Frozennode\\Administrator\\Fields\\Field'); $field->shouldReceive('getOption')->times(5)->andReturn('field', false, 'name', true, array('test')); $relatedItems = array($relatedModel1); $this->config->shouldReceive('getModelRelatedItems')->once()->andReturn($relatedItems); $this->config->setModelRelationship($model, $field); $this->assertEquals($model->field, 1); $this->assertEquals($model->field_options, array('test')); $this->assertEquals($model->field_autocomplete, array(1 => array('id' => 1, 'text' => 'model_1'))); }