public function storeMetaInDb($data) { $errors = []; foreach ($data as $title => $meta) { $errors[$title] = 'OK'; try { $model = ArticleMetadataModel::newFromString($title); foreach ($meta as $field => $val) { $model->setField($field, $val); } $model->save(true); } catch (TitleNotFoundException $e) { $errors[$title] = 'Title not found'; } catch (FieldNotArrayException $e) { $errors[$title] = 'Field should not be an array: ' . $e->getMessage(); } catch (NotValidPOIMetadataFieldException $e) { $errors[$title] = 'Unknown field: ' . $e->getMessage(); } } return $errors; }
/** * @group UsingDB * @expectedException TitleNotFoundException * @covers ArticleMetadataModel::newFromString */ public function testIndexNotFound() { ArticleMetadataModel::newFromString("bnvghcfrt6t7y8uhgftdr567"); }