parse(fopen(__FILE__, 'a')); } public function testDecodeLatin1() { $vcard = <<setCharset('ISO-8859-1'); $vcard = $mimeDir->parse($vcard); $this->assertEquals("umlaut u - \xC3\xBC", $vcard->FN->getValue()); } public function testDecodeInlineLatin1() { $vcard = <<parse($vcard); $this->assertEquals("umlaut u - \xC3\xBC", $vcard->FN->getValue()); } public function testIgnoreCharsetVCard30() { $vcard = <<parse($vcard); $this->assertEquals("foo-bar - \xFC", $vcard->FN->getValue()); } public function testDontDecodeLatin1() { $vcard = <<parse($vcard); // This basically tests that we don't touch the input string if // the encoding was set to UTF-8. The result is actually invalid // and the validator should report this, but it tests effectively // that we pass through the string byte-by-byte. $this->assertEquals("umlaut u - \xFC", $vcard->FN->getValue()); } /** * @expectedException \InvalidArgumentException */ public function testDecodeUnsupportedCharset() { $mimeDir = new MimeDir(); $mimeDir->setCharset('foobar'); } /** * @expectedException \Sabre\VObject\ParseException */ public function testDecodeUnsupportedInlineCharset() { $vcard = <<parse($vcard); } public function testDecodeWindows1252() { $vcard = <<setCharset('Windows-1252'); $vcard = $mimeDir->parse($vcard); $this->assertEquals("Euro \xE2\x82\xAC", $vcard->FN->getValue()); } public function testDecodeWindows1252Inline() { $vcard = <<parse($vcard); $this->assertEquals("Euro \xE2\x82\xAC", $vcard->FN->getValue()); } public function testCaseInsensitiveInlineCharset() { $vcard = <<parse($vcard); // we can do a simple assertion here. As long as we don't get an exception, everything is thing $this->assertEquals('Euro', $vcard->FN->getValue()); $this->assertEquals('Test2', $vcard->N->getValue()); } }