/** * Check the format of the VCARD skeleton (begin, end, version), * remove those lines, and return the remaining lines (sorted). * Utility for use in __toString() tests. * @arg $vcard_string The vcard output to check * @return An array of the remaining lines (no newlines). */ public function checkAndRemoveSkeleton($vcard_string) { $lines = explode("\n", VCardParser::unfold4($vcard_string)); $this->assertGreaterThan(4, count($lines)); $line = array_pop($lines); $this->assertEmpty($line); $line = array_pop($lines); $this->assertEquals(self::$vcard_end, $line); $line = array_shift($lines); $this->assertEquals(self::$vcard_begin, $line); $line = array_shift($lines); $this->assertEquals(self::$vcard_version, $line); sort($lines); return $lines; }
/** * Some cards for testing. * @return an organization VCard. */ public function getJohnDoe() { if (null === $this->johnDoe) { $path = __DIR__ . '/vcards/JohnDoe.vcf'; $parser = new VCardParser(); $vcards = $parser->importFromFile($path); $this->assertCount(1, $vcards); $this->johnDoe = $vcards[0]; } return $this->johnDoe; }