private function model(QueryHit $hit) { $model = $this->newInstanceBy($hit->{'class_uid'}); // Set primary key value $model->setAttribute($model->getKeyName(), $hit->{'primary_key'}); // Set score // $model->setAttribute('score', $hit->score); return $model; }
/** * @expectedException \InvalidArgumentException * @expectedExceptionMessage Can't find class for classUid: '999' */ public function testModelWithIncorrectClassUid() { $hit = m::mock('ZendSearch\\Lucene\\Search\\QueryHit'); $hit->class_uid = '999'; $this->config->model($hit); }