/**
  * @expectedException \InvalidArgumentException
  * @expectedExceptionMessage cannot find field for alias 'myUnknownField'
  */
 public function test_that_getting_a_field_by_unknown_alias_throws_exception()
 {
     $resource = new Resource('my__0', 'myCoolResource', 'my_cool_table', 'my_cool_id');
     $field = new Field($resource, 'myCoolField', 'my_cool_field', Field::TYPE_STRING);
     $resource->addField($field);
     $this->assertEquals($field, $resource->getFieldByAlias('myUnknownField'));
 }
 public function formatSimpleFieldInResource(Resource $resource, $fieldAlias, $fieldValue)
 {
     $fieldObj = $resource->getFieldByAlias($fieldAlias);
     $fieldFormatter = $this->fieldFormatterFactory->buildFieldFormatterForField($fieldObj);
     return $fieldFormatter->format($fieldValue);
 }