/** * Find a field by it's id and scope (page or global) * * @param integer $fieldId * @param string $fieldScope * @return DvsField || DvsGlobalField */ public function findFieldByIdAndScope($fieldId, $fieldScope) { return $fieldScope == 'global' ? $this->GlobalField->find($fieldId) : $this->Field->find($fieldId); }
public function test_it_finds_trashed_field_by_id_and_scope() { \DvsField::find(1)->delete(); $output = $this->FieldsRepository->findTrashedFieldByIdAndScope(1, 'page'); assertEquals(1, $output->id); }