diff options
author | zotlabs <mike@macgirvin.com> | 2019-04-25 21:49:18 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2019-04-25 21:49:18 -0700 |
commit | e6521d1cf3166a888ad58b09059d9dc5746ad795 (patch) | |
tree | 6ab3e41d888f18b2dcad351f86c3ed0628eda307 /vendor/sabre/vobject/lib/PHPUnitAssertions.php | |
parent | 96785e8df1b325a32c93ebebf67ab5208f4088dc (diff) | |
parent | d689778465c0439d0ceae071dab2509e3f95403e (diff) | |
download | volse-hubzilla-e6521d1cf3166a888ad58b09059d9dc5746ad795.tar.gz volse-hubzilla-e6521d1cf3166a888ad58b09059d9dc5746ad795.tar.bz2 volse-hubzilla-e6521d1cf3166a888ad58b09059d9dc5746ad795.zip |
Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
Diffstat (limited to 'vendor/sabre/vobject/lib/PHPUnitAssertions.php')
-rw-r--r-- | vendor/sabre/vobject/lib/PHPUnitAssertions.php | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/vendor/sabre/vobject/lib/PHPUnitAssertions.php b/vendor/sabre/vobject/lib/PHPUnitAssertions.php index 87ec75e8f..d77e4b1ed 100644 --- a/vendor/sabre/vobject/lib/PHPUnitAssertions.php +++ b/vendor/sabre/vobject/lib/PHPUnitAssertions.php @@ -3,7 +3,7 @@ namespace Sabre\VObject; /** - * PHPUnit Assertions + * PHPUnit Assertions. * * This trait can be added to your unittest to make it easier to test iCalendar * and/or vCards. @@ -12,8 +12,8 @@ namespace Sabre\VObject; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -trait PHPUnitAssertions { - +trait PHPUnitAssertions +{ /** * This method tests wether two vcards or icalendar objects are * semantically identical. @@ -30,13 +30,12 @@ trait PHPUnitAssertions { * * @param resource|string|Component $expected * @param resource|string|Component $actual - * @param string $message + * @param string $message */ - function assertVObjectEqualsVObject($expected, $actual, $message = '') { - + public function assertVObjectEqualsVObject($expected, $actual, $message = '') + { $self = $this; - $getObj = function($input) use ($self) { - + $getObj = function ($input) use ($self) { if (is_resource($input)) { $input = stream_get_contents($input); } @@ -47,11 +46,11 @@ trait PHPUnitAssertions { $this->fail('Input must be a string, stream or VObject component'); } unset($input->PRODID); - if ($input instanceof Component\VCalendar && (string)$input->CALSCALE === 'GREGORIAN') { + if ($input instanceof Component\VCalendar && 'GREGORIAN' === (string) $input->CALSCALE) { unset($input->CALSCALE); } - return $input; + return $input; }; $expected = $getObj($expected)->serialize(); @@ -61,13 +60,11 @@ trait PHPUnitAssertions { preg_match_all('|^([A-Z]+):\\*\\*ANY\\*\\*\r$|m', $expected, $matches, PREG_SET_ORDER); foreach ($matches as $match) { - $actual = preg_replace( - '|^' . preg_quote($match[1], '|') . ':(.*)\r$|m', - $match[1] . ':**ANY**' . "\r", + '|^'.preg_quote($match[1], '|').':(.*)\r$|m', + $match[1].':**ANY**'."\r", $actual ); - } $this->assertEquals( @@ -75,8 +72,5 @@ trait PHPUnitAssertions { $actual, $message ); - } - - } |