1<?php 2 3namespace Sabre\VObject; 4 5class TestCase extends \PHPUnit_Framework_TestCase { 6 7 /** 8 * This method tests wether two vcards or icalendar objects are 9 * semantically identical. 10 * 11 * It supports objects being supplied as strings, streams or 12 * Sabre\VObject\Component instances. 13 * 14 * PRODID is removed from both objects as this is often variable. 15 * 16 * @param resource|string|Component $expected 17 * @param resource|string|Component $actual 18 * @param string $message 19 */ 20 function assertVObjEquals($expected, $actual, $message = '') { 21 22 $self = $this; 23 $getObj = function($input) use ($self) { 24 25 if (is_resource($input)) { 26 $input = stream_get_contents($input); 27 } 28 if (is_string($input)) { 29 $input = Reader::read($input); 30 } 31 if (!$input instanceof Component) { 32 $this->fail('Input must be a string, stream or VObject component'); 33 } 34 unset($input->PRODID); 35 return $input; 36 37 }; 38 39 $expected = $getObj($expected); 40 $actual = $getObj($actual); 41 42 $this->assertEquals( 43 $expected->serialize(), 44 $actual->serialize(), 45 $message 46 ); 47 48 } 49 50} 51