-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from wadmiraal/master
Issue #69: Handle grouped properties
- Loading branch information
Showing
3 changed files
with
27 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -153,17 +153,17 @@ public function testUrl() | |
$this->assertEquals($parser->getCardAtIndex(0)->url['PREF;WORK'][0], 'http://work1.example.com'); | ||
$this->assertEquals($parser->getCardAtIndex(0)->url['PREF;WORK'][1], 'http://work2.example.com'); | ||
} | ||
|
||
public function testNote() | ||
{ | ||
$vcard = new VCard(); | ||
$vcard->addNote('This is a testnote'); | ||
$parser = new VCardParser($vcard->buildVCard()); | ||
|
||
$vcardMultiline = new VCard(); | ||
$vcardMultiline->addNote("This is a multiline note\nNew line content!\r\nLine 2"); | ||
$parserMultiline = new VCardParser($vcardMultiline->buildVCard()); | ||
|
||
$this->assertEquals($parser->getCardAtIndex(0)->note, 'This is a testnote'); | ||
$this->assertEquals(nl2br($parserMultiline->getCardAtIndex(0)->note), nl2br("This is a multiline note" . PHP_EOL . "New line content!" . PHP_EOL . "Line 2")); | ||
} | ||
|
@@ -275,6 +275,10 @@ public function testFromFile() | |
$this->assertEquals($cards[0]->firstname, "Wouter"); | ||
$this->assertEquals($cards[0]->lastname, "Admiraal"); | ||
$this->assertEquals($cards[0]->fullname, "Wouter Admiraal"); | ||
// Check the parsing of grouped items as well, which are present in the | ||
// example file. | ||
$this->assertEquals($cards[0]->url['default'][0], 'http://example.com'); | ||
$this->assertEquals($cards[0]->email['INTERNET'][0], '[email protected]'); | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,8 @@ VERSION:3.0 | |
REV:2016-05-30T10:36:13Z | ||
N;CHARSET=utf-8:Admiraal;Wouter;;; | ||
FN;CHARSET=utf-8:Wouter Admiraal | ||
item1.EMAIL;type=INTERNET:[email protected] | ||
item1.X-ABLabel:$!<Email>!$ | ||
item2.URL:http://example.com | ||
item2.X-ABLabel:$!<Home>!$ | ||
END:VCARD |