Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.5.0

Request #14969 Property groups not supported
Submitted: 2008-11-07 12:45 UTC
From: andreww Assigned: till
Status: Analyzed Package: File_IMC
PHP Version: 5.2.6 OS: Windows
Roadmaps: (Not assigned)    
Subscription  


 [2008-11-07 12:45 UTC] andreww (Andrew Whitehouse)
Description: ------------ Parser fails to parse the VCard correclty if name property is prefixed with a group. Test script: --------------- // Excerpt from PHPUnit test $familyName = "FamilyName"; $givenName = "GivenName"; $additionalNames = "Additional Names"; $prefix = "Prefix."; $suffix = "Suffix"; $name = "A.N"; $vcard = "BEGIN:VCARD\n\r" . $name . ":" . $familyName . ";" . $givenName . ";" . $additionalNames . ";" . $prefix . ";" . $suffix . "\n\r" . "END:VCARD"; $parser = new Contact_Vcard_Parse(); $ret = $parser->fromText( $vcard ); $values = $ret[0][$name][0]['value']; $this->assertEquals( $familyName, $values[0][0] ); $this->assertEquals( $givenName, $values[1][0] ); $this->assertEquals( $additionalNames, $values[2][0] ); $this->assertEquals( $prefix, $values[3][0] ); $this->assertEquals( $suffix, $values[4][0] ); Expected result: ---------------- Assertions pass. Actual result: -------------- There was 1 failure: 1) testPropertyGroups(ContactVcardParseTest) Failed asserting that two strings are equal. expected string <FamilyName> difference < ??????????????????????????????????????????> got string <FamilyName;GivenName;Additional Names;Prefix.;Suffix> Z:\repos\php\tests\ContactVcardParseTest.php:40 Z:\repos\php\tests\ContactVcardParseTest.php:90 Z:\repos\php\tests\ContactVcardParseTest.php:100

Comments

 [2008-11-07 13:02 UTC] doconnor (Daniel O'Connor)
Hey Andrew, neat, you have some tests for this class. I don't suppose you can attach the test case to this bug? (as a patch?) That'll speed things up.
 [2008-11-07 13:52 UTC] andreww (Andrew Whitehouse)
Hi Daniel, PHPUnit test attached.
 [2008-11-17 04:55 UTC] doconnor (Daniel O'Connor)
Psst, Till, wanna take a look?
 [2008-11-17 11:35 UTC] till (Till Klampaeckel)
Psst, I will. I'm behind on my bugs. I'll work on them this week. Thanks very much for the patch!
 [2008-12-28 02:30 UTC] doconnor (Daniel O'Connor)
I committed the shiny unit test for you till.
 [2009-06-29 00:03 UTC] till (Till Klampaeckel)
-Status: Verified +Status: Feedback
Hey Andrew, sorry for the late reply, but you happen to have a fix too? Thanks, Till
 [2009-09-18 03:49 UTC] till (Till Klampaeckel)
-Status: Feedback +Status: Analyzed -Type: Bug +Type: Feature/Change Request
Hey guys, I spend some time with these "patches" and tests tonight and the test to demo that Contact_Vcard_Parse doesn't support property groups didn't make any sense to me. I briefly researched what property groups are and found a nice example on Horde's bug tracker. So I added a new method (for now -- should be a dataProvider) etc. as a reminder and marked the test incomplete for now. Check it out: http://svn.php.net/viewvc/pear/packages/Contact_Vcard_Parse/trunk/tests/Contac tVcardParseTest.php?revision=288419&view=markup The method is, "getPropertyGroupVcard()" and the "item1." stuff is supposed to make the group. So, generally, I don't know how to make this package any better in its current state. I could technically stack it somewhere but the stacked arrays are not very pretty or intuitive. Maybe we'll keep this as a reminder for a next version of this package, or I migrate it to File_IMC. If you guys have suggestions, I'm all ears.
 [2011-03-20 01:54 UTC] till (Till Klampaeckel)
-Package: Contact_Vcard_Parse +Package: File_IMC
Moving to File_IMC.