Mercurial > hg > rc1
view vendor/sabre/vobject/tests/VObject/TestCase.php @ 35:05c4c32948af
.hgignore: add vendor tree
composer.json: new packages
plugins/thunderbird_labels/thunderbird_labels.php: change hook and RFC822 use wrt whitelisting to avoid deprecated stuff
index.php: commented debugging hooks
others: new releases of vendor packages?
| author | Charlie Root |
|---|---|
| date | Thu, 30 Aug 2018 16:21:59 -0400 |
| parents | 430dbd5346f7 |
| children |
line wrap: on
line source
<?php namespace Sabre\VObject; class TestCase extends \PHPUnit_Framework_TestCase { /** * This method tests wether two vcards or icalendar objects are * semantically identical. * * It supports objects being supplied as strings, streams or * Sabre\VObject\Component instances. * * PRODID is removed from both objects as this is often variable. * * @param resource|string|Component $expected * @param resource|string|Component $actual * @param string $message */ function assertVObjEquals($expected, $actual, $message = '') { $self = $this; $getObj = function($input) use ($self) { if (is_resource($input)) { $input = stream_get_contents($input); } if (is_string($input)) { $input = Reader::read($input); } if (!$input instanceof Component) { $this->fail('Input must be a string, stream or VObject component'); } unset($input->PRODID); return $input; }; $expected = $getObj($expected); $actual = $getObj($actual); $this->assertEquals( $expected->serialize(), $actual->serialize(), $message ); } }
