public function testParseInvalidType() { try { $this->parser->parse('t e x t/html; charset=ISO-8859-4'); } catch (\webignition\InternetMediaType\Parser\TypeParserException $exception) { $this->assertEquals(1, $exception->getCode()); return; } $this->fail('Invalid internal character exception not thrown'); }
/** * * @param string $possibleTypeSubtype * @return string|null */ private function getTypeSubtypeFromPossibleTypeSubtype($possibleTypeSubtype) { try { $typeParser = new TypeParser(); $type = $typeParser->parse($possibleTypeSubtype); $subtypeParser = new SubtypeParser(); $subtype = $subtypeParser->parse($possibleTypeSubtype); return $type . self::TYPE_SUBTYPE_SEPARATOR . $subtype; } catch (\Exception $ex) { return null; } }