/**
  * Sets the value of the header field.
  *
  * Accepts either strings or objects of type \Ableron\Lib\Net\InternetMediaType.
  *
  * @param string|\Ableron\Lib\Net\InternetMediaType $fieldValue The field value to set
  * @throws \Ableron\Core\Exception\SystemException
  * @return void
  */
 public function setFieldValue($fieldValue)
 {
     if (is_string($fieldValue)) {
         $this->fieldValue = InternetMediaType::parse($fieldValue);
     } elseif ($fieldValue instanceof InternetMediaType) {
         $this->fieldValue = $fieldValue;
     } else {
         throw new SystemException(sprintf('Unable to set header field value to %s - Field value must be a string or an object of type \\Ableron\\Lib\\Net\\InternetMediaType. Given: %s', StringUtil::toString($fieldValue), gettype($fieldValue)), 0, E_USER_WARNING, __FILE__, __LINE__);
     }
 }
 /**
  * Tests whether parse() works as expected.
  *
  * @dataProvider dataProviderTestParse
  * @return void
  */
 public function testParse($internetMediaTypeString, $expectedResult)
 {
     $internetMediaType = InternetMediaType::parse($internetMediaTypeString);
     $this->assertSame($expectedResult['toString'], $internetMediaType->toString());
     $this->assertSame($expectedResult['primaryType'], $internetMediaType->getPrimaryType());
     $this->assertSame($expectedResult['subType'], $internetMediaType->getSubType());
     $this->assertSame($expectedResult['baseType'], $internetMediaType->getBaseType());
     $this->assertSame($expectedResult['parameterString'], $internetMediaType->getParametersAsString());
 }
 /**
  * Checks whether display() throws an exception on non-existing template.
  *
  * @return void
  */
 public function testDisplayChecksTemplateExistence()
 {
     try {
         $this->getTemplateHandler()->display('/FooBarBaz/Templates/Frontend/fooBarBaz.tpl', InternetMediaType::parse('text/html'));
         $this->fail('display() does not check for template existence');
     } catch (SystemException $e) {
         $this->assertSame('Template file does not exist: /FooBarBaz/Templates/Frontend/fooBarBaz.tpl', $e->getMessage());
         $this->assertSame(0, $e->getCode());
         $this->assertSame(E_USER_ERROR, $e->getSeverity());
     }
 }