Page MenuHomePhabricator

LanguageTagTest.php
No OneTemporary

LanguageTagTest.php

<?php
namespace Sabre\VObject\Property\VCard;
use Sabre\VObject;
class LanguageTagTest extends \PHPUnit_Framework_TestCase {
function testMimeDir() {
$input = "BEGIN:VCARD\r\nVERSION:4.0\r\nLANG:nl\r\nEND:VCARD\r\n";
$mimeDir = new VObject\Parser\MimeDir($input);
$result = $mimeDir->parse($input);
$this->assertInstanceOf('Sabre\VObject\Property\VCard\LanguageTag', $result->LANG);
$this->assertEquals('nl', $result->LANG->getValue());
$this->assertEquals(
$input,
$result->serialize()
);
}
function testChangeAndSerialize() {
$input = "BEGIN:VCARD\r\nVERSION:4.0\r\nLANG:nl\r\nEND:VCARD\r\n";
$mimeDir = new VObject\Parser\MimeDir($input);
$result = $mimeDir->parse($input);
$this->assertInstanceOf('Sabre\VObject\Property\VCard\LanguageTag', $result->LANG);
// This replicates what the vcard converter does and triggered a bug in
// the past.
$result->LANG->setValue(array('de'));
$this->assertEquals('de', $result->LANG->getValue());
$expected = "BEGIN:VCARD\r\nVERSION:4.0\r\nLANG:de\r\nEND:VCARD\r\n";
$this->assertEquals(
$expected,
$result->serialize()
);
}
}

File Metadata

Mime Type
text/x-php
Expires
Sun, Dec 22, 6:07 AM (5 d, 4 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
916974
Default Alt Text
LanguageTagTest.php (1 KB)

Event Timeline