[Pkg-owncloud-commits] [php-sabredav] 53/80: CS fixes.
David Prévot
taffit at moszumanska.debian.org
Thu Jan 7 02:56:33 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository php-sabredav.
commit c6c53a081e6e3d7ef34b13c1dd2c613a0a944e3f
Author: Evert Pot <me at evertpot.com>
Date: Mon Jan 4 20:59:55 2016 -0500
CS fixes.
---
CHANGELOG.md | 2 +
bin/build.php | 18 +-
bin/migrateto17.php | 52 +--
bin/migrateto20.php | 36 +-
bin/migrateto21.php | 16 +-
bin/migrateto30.php | 18 +-
bin/sabredav.php | 10 +-
tests/Sabre/CalDAV/Backend/AbstractPDOTest.php | 488 ++++++++++-----------
tests/Sabre/CalDAV/Backend/AbstractTest.php | 128 +++---
tests/Sabre/CalDAV/Backend/Mock.php | 51 +--
tests/Sabre/CalDAV/Backend/MockScheduling.php | 16 +-
tests/Sabre/CalDAV/Backend/MockSharing.php | 9 +-
.../CalDAV/Backend/MockSubscriptionSupport.php | 19 +-
tests/Sabre/CalDAV/Backend/PDOMySQLTest.php | 4 +-
tests/Sabre/CalDAV/Backend/PDOSqliteTest.php | 6 +-
tests/Sabre/DAV/ServerRangeTest.php | 8 +-
16 files changed, 441 insertions(+), 440 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 10fbb18..c4978b1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,11 +5,13 @@ ChangeLog
-------------------------
* Better error message when the browser plugin is not enabled.
+* Added a super minimal server example.
* #730: Switched all mysql tables to `utf8mb4` character set, allowing you to
use emoji in some tables where you couldn't before.
* #729: Not all calls to `Sabre\DAV\Tree::getChildren()` were properly cached.
* #727: Added another workaround to make CalDAV work for Windows 10 clients.
* #742: Fixes to make sure that vobject 4 is correctly supported.
+* Subtle browser improvements.
3.1.0-alpha2 (2015-09-05)
diff --git a/bin/build.php b/bin/build.php
index 8b78d88..82b1e75 100755
--- a/bin/build.php
+++ b/bin/build.php
@@ -10,10 +10,10 @@ $tasks = [
'init', 'test', 'clean',
],
'clean' => [],
- 'test' => [
+ 'test' => [
'composerupdate',
],
- 'init' => [],
+ 'init' => [],
'composerupdate' => [],
];
@@ -36,9 +36,9 @@ if (!isset($tasks[$currentTask])) {
$newTaskList = [];
$oldTaskList = [$currentTask => true];
-while(count($oldTaskList)>0) {
+while (count($oldTaskList) > 0) {
- foreach($oldTaskList as $task=>$foo) {
+ foreach ($oldTaskList as $task => $foo) {
if (!isset($tasks[$task])) {
echo "Dependency not found: " . $task, "\n";
@@ -47,7 +47,7 @@ while(count($oldTaskList)>0) {
$dependencies = $tasks[$task];
$fullFilled = true;
- foreach($dependencies as $dependency) {
+ foreach ($dependencies as $dependency) {
if (isset($newTaskList[$dependency])) {
// Already in the fulfilled task list.
continue;
@@ -66,7 +66,7 @@ while(count($oldTaskList)>0) {
}
-foreach(array_keys($newTaskList) as $task) {
+foreach (array_keys($newTaskList) as $task) {
echo "task: " . $task, "\n";
call_user_func($task);
@@ -129,7 +129,7 @@ function buildzip() {
"config" => [
"bin-dir" => "./bin",
],
- "prefer-stable" => true,
+ "prefer-stable" => true,
"minimum-stability" => "alpha",
];
unset(
@@ -144,7 +144,7 @@ function buildzip() {
echo " Downloading dependencies\n";
system("cd build/SabreDAV; composer install -n", $code);
- if ($code!==0) {
+ if ($code !== 0) {
echo "Composer reported error code $code\n";
die(1);
}
@@ -161,7 +161,7 @@ function buildzip() {
'README.md',
'examples',
];
- foreach($fileNames as $fileName) {
+ foreach ($fileNames as $fileName) {
echo " $fileName\n";
rename('build/SabreDAV/vendor/sabre/dav/' . $fileName, 'build/SabreDAV/' . $fileName);
}
diff --git a/bin/migrateto17.php b/bin/migrateto17.php
index 3ccf0a3..a1173c5 100755
--- a/bin/migrateto17.php
+++ b/bin/migrateto17.php
@@ -3,7 +3,7 @@
echo "SabreDAV migrate script for version 1.7\n";
-if ($argc<2) {
+if ($argc < 2) {
echo <<<HELLO
@@ -35,12 +35,12 @@ HELLO;
// There's a bunch of places where the autoloader could be, so we'll try all of
// them.
-$paths = array(
+$paths = [
__DIR__ . '/../vendor/autoload.php',
__DIR__ . '/../../../autoload.php',
-);
+];
-foreach($paths as $path) {
+foreach ($paths as $path) {
if (file_exists($path)) {
include $path;
break;
@@ -48,8 +48,8 @@ foreach($paths as $path) {
}
$dsn = $argv[1];
-$user = isset($argv[2])?$argv[2]:null;
-$pass = isset($argv[3])?$argv[3]:null;
+$user = isset($argv[2]) ? $argv[2] : null;
+$pass = isset($argv[3]) ? $argv[3] : null;
echo "Connecting to database: " . $dsn . "\n";
@@ -67,32 +67,32 @@ if (!$row) {
exit(-1);
}
-$requiredFields = array(
+$requiredFields = [
'id',
'calendardata',
'uri',
'calendarid',
'lastmodified',
-);
+];
-foreach($requiredFields as $requiredField) {
- if (!array_key_exists($requiredField,$row)) {
+foreach ($requiredFields as $requiredField) {
+ if (!array_key_exists($requiredField, $row)) {
echo "Error: The current 'calendarobjects' table was missing a field we expected to exist.\n";
echo "For safety reasons, this process is stopped.\n";
exit(-1);
}
}
-$fields17 = array(
+$fields17 = [
'etag',
'size',
'componenttype',
'firstoccurence',
'lastoccurence',
-);
+];
$found = 0;
-foreach($fields17 as $field) {
+foreach ($fields17 as $field) {
if (array_key_exists($field, $row)) {
$found++;
}
@@ -102,7 +102,7 @@ if ($found === 0) {
echo "The database had the 1.6 schema. Table will now be altered.\n";
echo "This may take some time for large tables\n";
- switch($pdo->getAttribute(PDO::ATTR_DRIVER_NAME)) {
+ switch ($pdo->getAttribute(PDO::ATTR_DRIVER_NAME)) {
case 'mysql' :
@@ -150,7 +150,7 @@ $stmt = $pdo->prepare('UPDATE calendarobjects SET etag = ?, size = ?, componentt
echo "Total records found: " . $result->rowCount() . "\n";
$done = 0;
$total = $result->rowCount();
-while($row = $result->fetch()) {
+while ($row = $result->fetch()) {
try {
$newData = getDenormalizedData($row['calendardata']);
@@ -161,14 +161,14 @@ while($row = $result->fetch()) {
echo "This record is ignored, you should inspect it to see if there's anything wrong.\n===\n";
continue;
}
- $stmt->execute(array(
+ $stmt->execute([
$newData['etag'],
$newData['size'],
$newData['componentType'],
$newData['firstOccurence'],
$newData['lastOccurence'],
$row['id'],
- ));
+ ]);
$done++;
if ($done % 500 === 0) {
@@ -188,7 +188,7 @@ if (array_key_exists('transparent', $row)) {
echo "Adding the 'transparent' field to the calendars table\n";
- switch($pdo->getAttribute(PDO::ATTR_DRIVER_NAME)) {
+ switch ($pdo->getAttribute(PDO::ATTR_DRIVER_NAME)) {
case 'mysql' :
$pdo->exec("ALTER TABLE calendars ADD transparent TINYINT(1) NOT NULL DEFAULT '0'");
@@ -229,8 +229,8 @@ function getDenormalizedData($calendarData) {
$component = null;
$firstOccurence = null;
$lastOccurence = null;
- foreach($vObject->getComponents() as $component) {
- if ($component->name!=='VTIMEZONE') {
+ foreach ($vObject->getComponents() as $component) {
+ if ($component->name !== 'VTIMEZONE') {
$componentType = $component->name;
break;
}
@@ -262,7 +262,7 @@ function getDenormalizedData($calendarData) {
$lastOccurence = $maxDate->getTimeStamp();
} else {
$end = $it->getDtEnd();
- while($it->valid() && $end < $maxDate) {
+ while ($it->valid() && $end < $maxDate) {
$end = $it->getDtEnd();
$it->next();
@@ -273,12 +273,12 @@ function getDenormalizedData($calendarData) {
}
}
- return array(
- 'etag' => md5($calendarData),
- 'size' => strlen($calendarData),
- 'componentType' => $componentType,
+ return [
+ 'etag' => md5($calendarData),
+ 'size' => strlen($calendarData),
+ 'componentType' => $componentType,
'firstOccurence' => $firstOccurence,
'lastOccurence' => $lastOccurence,
- );
+ ];
}
diff --git a/bin/migrateto20.php b/bin/migrateto20.php
index 3118104..7723680 100755
--- a/bin/migrateto20.php
+++ b/bin/migrateto20.php
@@ -3,7 +3,7 @@
echo "SabreDAV migrate script for version 2.0\n";
-if ($argc<2) {
+if ($argc < 2) {
echo <<<HELLO
@@ -46,7 +46,7 @@ $paths = [
__DIR__ . '/../../../autoload.php',
];
-foreach($paths as $path) {
+foreach ($paths as $path) {
if (file_exists($path)) {
include $path;
break;
@@ -54,8 +54,8 @@ foreach($paths as $path) {
}
$dsn = $argv[1];
-$user = isset($argv[2])?$argv[2]:null;
-$pass = isset($argv[3])?$argv[3]:null;
+$user = isset($argv[2]) ? $argv[2] : null;
+$pass = isset($argv[3]) ? $argv[3] : null;
echo "Connecting to database: " . $dsn . "\n";
@@ -65,7 +65,7 @@ $pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
$driver = $pdo->getAttribute(PDO::ATTR_DRIVER_NAME);
-switch($driver) {
+switch ($driver) {
case 'mysql' :
echo "Detected MySQL.\n";
@@ -78,7 +78,7 @@ switch($driver) {
die(-1);
}
-foreach(['calendar', 'addressbook'] as $itemType) {
+foreach (['calendar', 'addressbook'] as $itemType) {
$tableName = $itemType . 's';
$tableNameOld = $tableName . '_old';
@@ -96,11 +96,11 @@ foreach(['calendar', 'addressbook'] as $itemType) {
echo "We're going to rename the old table to $tableNameOld (just in case).\n";
echo "and re-create the new table.\n";
- switch($driver) {
+ switch ($driver) {
case 'mysql' :
$pdo->exec("RENAME TABLE $tableName TO $tableNameOld");
- switch($itemType) {
+ switch ($itemType) {
case 'calendar' :
$pdo->exec("
CREATE TABLE calendars (
@@ -139,7 +139,7 @@ foreach(['calendar', 'addressbook'] as $itemType) {
$pdo->exec("ALTER TABLE $tableName RENAME TO $tableNameOld");
- switch($itemType) {
+ switch ($itemType) {
case 'calendar' :
$pdo->exec("
CREATE TABLE calendars (
@@ -186,7 +186,7 @@ foreach(['calendar', 'addressbook'] as $itemType) {
} else {
echo "1.8 table schema detected\n";
- switch($driver) {
+ switch ($driver) {
case 'mysql' :
$pdo->exec("ALTER TABLE $tableName ADD synctoken INT(11) UNSIGNED NOT NULL DEFAULT '1'");
@@ -217,7 +217,7 @@ foreach(['calendar', 'addressbook'] as $itemType) {
} catch (Exception $e) {
echo "Creating '$changesTable' table.\n";
- switch($driver) {
+ switch ($driver) {
case 'mysql' :
$pdo->exec("
@@ -262,7 +262,7 @@ try {
} catch (Exception $e) {
echo "Creating calendarsubscriptions table.\n";
- switch($driver) {
+ switch ($driver) {
case 'mysql' :
$pdo->exec("
@@ -318,7 +318,7 @@ try {
} catch (Exception $e) {
echo "Creating propertystorage table.\n";
- switch($driver) {
+ switch ($driver) {
case 'mysql' :
$pdo->exec("
@@ -359,13 +359,13 @@ try {
$create = false;
$row = $pdo->query("SELECT * FROM cards LIMIT 1")->fetch();
if (!$row) {
- $random = mt_rand(1000,9999);
+ $random = mt_rand(1000, 9999);
echo "There was no data in the cards table, so we're re-creating it\n";
echo "The old table will be renamed to cards_old$random, just in case.\n";
$create = true;
- switch($driver) {
+ switch ($driver) {
case 'mysql' :
$pdo->exec("RENAME TABLE cards TO cards_old$random");
break;
@@ -385,7 +385,7 @@ try {
}
if ($create) {
- switch($driver) {
+ switch ($driver) {
case 'mysql' :
$pdo->exec("
CREATE TABLE cards (
@@ -418,7 +418,7 @@ CREATE TABLE cards (
}
} else {
- switch($driver) {
+ switch ($driver) {
case 'mysql' :
$pdo->exec("
ALTER TABLE cards
@@ -439,7 +439,7 @@ CREATE TABLE cards (
echo "Reading all old vcards and populating etag and size fields.\n";
$result = $pdo->query('SELECT id, carddata FROM cards');
$stmt = $pdo->prepare('UPDATE cards SET etag = ?, size = ? WHERE id = ?');
- while($row = $result->fetch(\PDO::FETCH_ASSOC)) {
+ while ($row = $result->fetch(\PDO::FETCH_ASSOC)) {
$stmt->execute([
md5($row['carddata']),
strlen($row['carddata']),
diff --git a/bin/migrateto21.php b/bin/migrateto21.php
index 9a5a315..f42c4cf 100755
--- a/bin/migrateto21.php
+++ b/bin/migrateto21.php
@@ -3,7 +3,7 @@
echo "SabreDAV migrate script for version 2.1\n";
-if ($argc<2) {
+if ($argc < 2) {
echo <<<HELLO
@@ -47,7 +47,7 @@ $paths = [
__DIR__ . '/../../../autoload.php',
];
-foreach($paths as $path) {
+foreach ($paths as $path) {
if (file_exists($path)) {
include $path;
break;
@@ -55,8 +55,8 @@ foreach($paths as $path) {
}
$dsn = $argv[1];
-$user = isset($argv[2])?$argv[2]:null;
-$pass = isset($argv[3])?$argv[3]:null;
+$user = isset($argv[2]) ? $argv[2] : null;
+$pass = isset($argv[3]) ? $argv[3] : null;
echo "Connecting to database: " . $dsn . "\n";
@@ -66,7 +66,7 @@ $pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
$driver = $pdo->getAttribute(PDO::ATTR_DRIVER_NAME);
-switch($driver) {
+switch ($driver) {
case 'mysql' :
echo "Detected MySQL.\n";
@@ -103,7 +103,7 @@ try {
if ($addUid) {
- switch($driver) {
+ switch ($driver) {
case 'mysql' :
$pdo->exec('ALTER TABLE calendarobjects ADD uid VARCHAR(200)');
break;
@@ -116,7 +116,7 @@ if ($addUid) {
$stmt = $pdo->prepare('UPDATE calendarobjects SET uid = ? WHERE id = ?');
$counter = 0;
- while($row = $result->fetch(\PDO::FETCH_ASSOC)) {
+ while ($row = $result->fetch(\PDO::FETCH_ASSOC)) {
try {
$vobj = \Sabre\VObject\Reader::read($row['calendardata']);
@@ -140,7 +140,7 @@ if ($addUid) {
echo "Creating 'schedulingobjects'\n";
-switch($driver) {
+switch ($driver) {
case 'mysql' :
$pdo->exec('CREATE TABLE IF NOT EXISTS schedulingobjects
diff --git a/bin/migrateto30.php b/bin/migrateto30.php
index 5c2179a..9ca77c1 100755
--- a/bin/migrateto30.php
+++ b/bin/migrateto30.php
@@ -3,7 +3,7 @@
echo "SabreDAV migrate script for version 3.0\n";
-if ($argc<2) {
+if ($argc < 2) {
echo <<<HELLO
@@ -46,7 +46,7 @@ $paths = [
__DIR__ . '/../../../autoload.php',
];
-foreach($paths as $path) {
+foreach ($paths as $path) {
if (file_exists($path)) {
include $path;
break;
@@ -54,8 +54,8 @@ foreach($paths as $path) {
}
$dsn = $argv[1];
-$user = isset($argv[2])?$argv[2]:null;
-$pass = isset($argv[3])?$argv[3]:null;
+$user = isset($argv[2]) ? $argv[2] : null;
+$pass = isset($argv[3]) ? $argv[3] : null;
echo "Connecting to database: " . $dsn . "\n";
@@ -65,7 +65,7 @@ $pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
$driver = $pdo->getAttribute(PDO::ATTR_DRIVER_NAME);
-switch($driver) {
+switch ($driver) {
case 'mysql' :
echo "Detected MySQL.\n";
@@ -86,10 +86,10 @@ try {
if (!$row) {
echo "No data in table. Going to re-create the table.\n";
- $random = mt_rand(1000,9999);
+ $random = mt_rand(1000, 9999);
echo "Renaming propertystorage -> propertystorage_old$random and creating new table.\n";
- switch($driver) {
+ switch ($driver) {
case 'mysql' :
$pdo->exec('RENAME TABLE propertystorage TO propertystorage_old' . $random);
@@ -135,7 +135,7 @@ CREATE TABLE propertystorage (
if ($addValueType) {
- switch($driver) {
+ switch ($driver) {
case 'mysql' :
$pdo->exec('ALTER TABLE propertystorage ADD valuetype INT UNSIGNED');
break;
@@ -154,7 +154,7 @@ echo "Migrating vcardurl\n";
$result = $pdo->query('SELECT id, uri, vcardurl FROM principals WHERE vcardurl IS NOT NULL');
$stmt1 = $pdo->prepare('INSERT INTO propertystorage (path, name, valuetype, value) VALUES (?, ?, 3, ?)');
-while($row = $result->fetch(\PDO::FETCH_ASSOC)) {
+while ($row = $result->fetch(\PDO::FETCH_ASSOC)) {
// Inserting the new record
$stmt1->execute([
diff --git a/bin/sabredav.php b/bin/sabredav.php
index 34a674f..950075d 100755
--- a/bin/sabredav.php
+++ b/bin/sabredav.php
@@ -8,7 +8,7 @@ class CliLog {
function __construct() {
- $this->stream = fopen('php://stdout','w');
+ $this->stream = fopen('php://stdout', 'w');
}
@@ -20,19 +20,19 @@ class CliLog {
$log = new CliLog();
-if (php_sapi_name()!=='cli-server') {
+if (php_sapi_name() !== 'cli-server') {
die("This script is intended to run on the built-in php webserver");
}
// Finding composer
-$paths = array(
+$paths = [
__DIR__ . '/../vendor/autoload.php',
__DIR__ . '/../../../autoload.php',
-);
+];
-foreach($paths as $path) {
+foreach ($paths as $path) {
if (file_exists($path)) {
include $path;
break;
diff --git a/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php b/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php
index 9dcfdea..25f8b17 100644
--- a/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php
+++ b/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php
@@ -24,7 +24,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$backend = new PDO($this->pdo);
$calendars = $backend->getCalendarsForUser('principals/user2');
- $this->assertEquals(array(),$calendars);
+ $this->assertEquals([], $calendars);
}
@@ -34,28 +34,28 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
function testCreateCalendarAndFetch() {
$backend = new PDO($this->pdo);
- $returnedId = $backend->createCalendar('principals/user2','somerandomid',array(
- '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new CalDAV\Xml\Property\SupportedCalendarComponentSet(array('VEVENT')),
- '{DAV:}displayname' => 'Hello!',
- '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp' => new CalDAV\Xml\Property\ScheduleCalendarTransp('transparent'),
- ));
+ $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', [
+ '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new CalDAV\Xml\Property\SupportedCalendarComponentSet(['VEVENT']),
+ '{DAV:}displayname' => 'Hello!',
+ '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp' => new CalDAV\Xml\Property\ScheduleCalendarTransp('transparent'),
+ ]);
$calendars = $backend->getCalendarsForUser('principals/user2');
- $elementCheck = array(
- 'id' => $returnedId,
- 'uri' => 'somerandomid',
- '{DAV:}displayname' => 'Hello!',
- '{urn:ietf:params:xml:ns:caldav}calendar-description' => '',
+ $elementCheck = [
+ 'id' => $returnedId,
+ 'uri' => 'somerandomid',
+ '{DAV:}displayname' => 'Hello!',
+ '{urn:ietf:params:xml:ns:caldav}calendar-description' => '',
'{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp' => new CalDAV\Xml\Property\ScheduleCalendarTransp('transparent'),
- );
+ ];
- $this->assertInternalType('array',$calendars);
- $this->assertEquals(1,count($calendars));
+ $this->assertInternalType('array', $calendars);
+ $this->assertEquals(1, count($calendars));
- foreach($elementCheck as $name=>$value) {
+ foreach ($elementCheck as $name => $value) {
$this->assertArrayHasKey($name, $calendars[0]);
- $this->assertEquals($value,$calendars[0][$name]);
+ $this->assertEquals($value, $calendars[0][$name]);
}
@@ -69,10 +69,10 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$backend = new PDO($this->pdo);
//Creating a new calendar
- $newId = $backend->createCalendar('principals/user2','somerandomid',array());
+ $newId = $backend->createCalendar('principals/user2', 'somerandomid', []);
$propPatch = new PropPatch([
- '{DAV:}displayname' => 'myCalendar',
+ '{DAV:}displayname' => 'myCalendar',
'{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp' => new CalDAV\Xml\Property\ScheduleCalendarTransp('transparent'),
]);
@@ -87,23 +87,23 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$calendars = $backend->getCalendarsForUser('principals/user2');
// Checking if all the information is still correct
- $elementCheck = array(
- 'id' => $newId,
- 'uri' => 'somerandomid',
- '{DAV:}displayname' => 'myCalendar',
- '{urn:ietf:params:xml:ns:caldav}calendar-description' => '',
- '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => '',
- '{http://calendarserver.org/ns/}getctag' => 'http://sabre.io/ns/sync/2',
+ $elementCheck = [
+ 'id' => $newId,
+ 'uri' => 'somerandomid',
+ '{DAV:}displayname' => 'myCalendar',
+ '{urn:ietf:params:xml:ns:caldav}calendar-description' => '',
+ '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => '',
+ '{http://calendarserver.org/ns/}getctag' => 'http://sabre.io/ns/sync/2',
'{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp' => new CalDAV\Xml\Property\ScheduleCalendarTransp('transparent'),
- );
+ ];
- $this->assertInternalType('array',$calendars);
- $this->assertEquals(1,count($calendars));
+ $this->assertInternalType('array', $calendars);
+ $this->assertEquals(1, count($calendars));
- foreach($elementCheck as $name=>$value) {
+ foreach ($elementCheck as $name => $value) {
$this->assertArrayHasKey($name, $calendars[0]);
- $this->assertEquals($value,$calendars[0][$name]);
+ $this->assertEquals($value, $calendars[0][$name]);
}
@@ -117,7 +117,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$backend = new PDO($this->pdo);
//Creating a new calendar
- $newId = $backend->createCalendar('principals/user2','somerandomid',array());
+ $newId = $backend->createCalendar('principals/user2', 'somerandomid', []);
$propPatch = new PropPatch([
'{DAV:}displayname' => 'myCalendar',
@@ -130,7 +130,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
// Verifying the result of the update
$this->assertEquals([
- '{DAV:}yourmom' => 403,
+ '{DAV:}yourmom' => 403,
'{DAV:}displayname' => 424,
], $propPatch->getResult());
@@ -142,15 +142,15 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
function testDeleteCalendar() {
$backend = new PDO($this->pdo);
- $returnedId = $backend->createCalendar('principals/user2','somerandomid',array(
- '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new CalDAV\Xml\Property\SupportedCalendarComponentSet(array('VEVENT')),
- '{DAV:}displayname' => 'Hello!',
- ));
+ $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', [
+ '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new CalDAV\Xml\Property\SupportedCalendarComponentSet(['VEVENT']),
+ '{DAV:}displayname' => 'Hello!',
+ ]);
$backend->deleteCalendar($returnedId);
$calendars = $backend->getCalendarsForUser('principals/user2');
- $this->assertEquals(array(),$calendars);
+ $this->assertEquals([], $calendars);
}
@@ -163,36 +163,36 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$backend = new PDO($this->pdo);
//Creating a new calendar
- $newId = $backend->createCalendar('principals/user2','somerandomid',array(
+ $newId = $backend->createCalendar('principals/user2', 'somerandomid', [
'{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => 'blabla',
- ));
+ ]);
}
function testCreateCalendarObject() {
$backend = new PDO($this->pdo);
- $returnedId = $backend->createCalendar('principals/user2','somerandomid',array());
+ $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []);
$object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n";
$backend->createCalendarObject($returnedId, 'random-id', $object);
$result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = "random-id"');
- $this->assertEquals(array(
- 'etag' => md5($object),
- 'size' => strlen($object),
- 'calendardata' => $object,
+ $this->assertEquals([
+ 'etag' => md5($object),
+ 'size' => strlen($object),
+ 'calendardata' => $object,
'firstoccurence' => strtotime('20120101'),
- 'lastoccurence' => strtotime('20120101')+(3600*24),
- 'componenttype' => 'VEVENT',
- ), $result->fetch(\PDO::FETCH_ASSOC));
+ 'lastoccurence' => strtotime('20120101') + (3600 * 24),
+ 'componenttype' => 'VEVENT',
+ ], $result->fetch(\PDO::FETCH_ASSOC));
}
function testGetMultipleObjects() {
$backend = new PDO($this->pdo);
- $returnedId = $backend->createCalendar('principals/user2','somerandomid',array());
+ $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []);
$object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n";
@@ -201,32 +201,32 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$check = [
[
- 'id' => 1,
- 'etag' => '"' . md5($object) . '"',
- 'uri' => 'id-1',
- 'size' => strlen($object),
+ 'id' => 1,
+ 'etag' => '"' . md5($object) . '"',
+ 'uri' => 'id-1',
+ 'size' => strlen($object),
'calendardata' => $object,
'lastmodified' => null,
- 'calendarid' => $returnedId,
+ 'calendarid' => $returnedId,
],
[
- 'id' => 2,
- 'etag' => '"' . md5($object) . '"',
- 'uri' => 'id-2',
- 'size' => strlen($object),
+ 'id' => 2,
+ 'etag' => '"' . md5($object) . '"',
+ 'uri' => 'id-2',
+ 'size' => strlen($object),
'calendardata' => $object,
'lastmodified' => null,
- 'calendarid' => $returnedId,
+ 'calendarid' => $returnedId,
],
];
$result = $backend->getMultipleCalendarObjects($returnedId, [ 'id-1', 'id-2' ]);
- foreach($check as $index => $props) {
+ foreach ($check as $index => $props) {
- foreach($props as $key=>$value) {
+ foreach ($props as $key => $value) {
- if ($key!=='lastmodified') {
+ if ($key !== 'lastmodified') {
$this->assertEquals($value, $result[$index][$key]);
} else {
$this->assertTrue(isset($result[$index][$key]));
@@ -245,7 +245,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
function testCreateCalendarObjectNoComponent() {
$backend = new PDO($this->pdo);
- $returnedId = $backend->createCalendar('principals/user2','somerandomid',array());
+ $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []);
$object = "BEGIN:VCALENDAR\r\nBEGIN:VTIMEZONE\r\nEND:VTIMEZONE\r\nEND:VCALENDAR\r\n";
@@ -259,21 +259,21 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
function testCreateCalendarObjectDuration() {
$backend = new PDO($this->pdo);
- $returnedId = $backend->createCalendar('principals/user2','somerandomid',array());
+ $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []);
$object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nDURATION:P2D\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n";
$backend->createCalendarObject($returnedId, 'random-id', $object);
$result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = "random-id"');
- $this->assertEquals(array(
- 'etag' => md5($object),
- 'size' => strlen($object),
- 'calendardata' => $object,
+ $this->assertEquals([
+ 'etag' => md5($object),
+ 'size' => strlen($object),
+ 'calendardata' => $object,
'firstoccurence' => strtotime('20120101'),
- 'lastoccurence' => strtotime('20120101')+(3600*48),
- 'componenttype' => 'VEVENT',
- ), $result->fetch(\PDO::FETCH_ASSOC));
+ 'lastoccurence' => strtotime('20120101') + (3600 * 48),
+ 'componenttype' => 'VEVENT',
+ ], $result->fetch(\PDO::FETCH_ASSOC));
}
@@ -283,21 +283,21 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
function testCreateCalendarObjectNoDTEND() {
$backend = new PDO($this->pdo);
- $returnedId = $backend->createCalendar('principals/user2','somerandomid',array());
+ $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []);
$object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE-TIME:20120101T100000Z\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n";
$backend->createCalendarObject($returnedId, 'random-id', $object);
$result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = "random-id"');
- $this->assertEquals(array(
- 'etag' => md5($object),
- 'size' => strlen($object),
- 'calendardata' => $object,
+ $this->assertEquals([
+ 'etag' => md5($object),
+ 'size' => strlen($object),
+ 'calendardata' => $object,
'firstoccurence' => strtotime('2012-01-01 10:00:00'),
- 'lastoccurence' => strtotime('2012-01-01 10:00:00'),
- 'componenttype' => 'VEVENT',
- ), $result->fetch(\PDO::FETCH_ASSOC));
+ 'lastoccurence' => strtotime('2012-01-01 10:00:00'),
+ 'componenttype' => 'VEVENT',
+ ], $result->fetch(\PDO::FETCH_ASSOC));
}
@@ -307,21 +307,21 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
function testCreateCalendarObjectWithDTEND() {
$backend = new PDO($this->pdo);
- $returnedId = $backend->createCalendar('principals/user2','somerandomid',array());
+ $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []);
$object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE-TIME:20120101T100000Z\r\nDTEND:20120101T110000Z\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n";
$backend->createCalendarObject($returnedId, 'random-id', $object);
$result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = "random-id"');
- $this->assertEquals(array(
- 'etag' => md5($object),
- 'size' => strlen($object),
- 'calendardata' => $object,
+ $this->assertEquals([
+ 'etag' => md5($object),
+ 'size' => strlen($object),
+ 'calendardata' => $object,
'firstoccurence' => strtotime('2012-01-01 10:00:00'),
- 'lastoccurence' => strtotime('2012-01-01 11:00:00'),
- 'componenttype' => 'VEVENT',
- ), $result->fetch(\PDO::FETCH_ASSOC));
+ 'lastoccurence' => strtotime('2012-01-01 11:00:00'),
+ 'componenttype' => 'VEVENT',
+ ], $result->fetch(\PDO::FETCH_ASSOC));
}
@@ -331,21 +331,21 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
function testCreateCalendarObjectInfiniteReccurence() {
$backend = new PDO($this->pdo);
- $returnedId = $backend->createCalendar('principals/user2','somerandomid',array());
+ $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []);
$object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE-TIME:20120101T100000Z\r\nRRULE:FREQ=DAILY\r\nUID:foo\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n";
$backend->createCalendarObject($returnedId, 'random-id', $object);
$result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = "random-id"');
- $this->assertEquals(array(
- 'etag' => md5($object),
- 'size' => strlen($object),
- 'calendardata' => $object,
+ $this->assertEquals([
+ 'etag' => md5($object),
+ 'size' => strlen($object),
+ 'calendardata' => $object,
'firstoccurence' => strtotime('2012-01-01 10:00:00'),
- 'lastoccurence' => strtotime(PDO::MAX_DATE),
- 'componenttype' => 'VEVENT',
- ), $result->fetch(\PDO::FETCH_ASSOC));
+ 'lastoccurence' => strtotime(PDO::MAX_DATE),
+ 'componenttype' => 'VEVENT',
+ ], $result->fetch(\PDO::FETCH_ASSOC));
}
@@ -355,21 +355,21 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
function testCreateCalendarObjectEndingReccurence() {
$backend = new PDO($this->pdo);
- $returnedId = $backend->createCalendar('principals/user2','somerandomid',array());
+ $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []);
$object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE-TIME:20120101T100000Z\r\nDTEND;VALUE=DATE-TIME:20120101T110000Z\r\nUID:foo\r\nRRULE:FREQ=DAILY;COUNT=1000\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n";
$backend->createCalendarObject($returnedId, 'random-id', $object);
$result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = "random-id"');
- $this->assertEquals(array(
- 'etag' => md5($object),
- 'size' => strlen($object),
- 'calendardata' => $object,
+ $this->assertEquals([
+ 'etag' => md5($object),
+ 'size' => strlen($object),
+ 'calendardata' => $object,
'firstoccurence' => strtotime('2012-01-01 10:00:00'),
- 'lastoccurence' => strtotime('2012-01-01 11:00:00') + (3600 * 24 * 999),
- 'componenttype' => 'VEVENT',
- ), $result->fetch(\PDO::FETCH_ASSOC));
+ 'lastoccurence' => strtotime('2012-01-01 11:00:00') + (3600 * 24 * 999),
+ 'componenttype' => 'VEVENT',
+ ], $result->fetch(\PDO::FETCH_ASSOC));
}
@@ -379,21 +379,21 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
function testCreateCalendarObjectTask() {
$backend = new PDO($this->pdo);
- $returnedId = $backend->createCalendar('principals/user2','somerandomid',array());
+ $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []);
$object = "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nDUE;VALUE=DATE-TIME:20120101T100000Z\r\nEND:VTODO\r\nEND:VCALENDAR\r\n";
$backend->createCalendarObject($returnedId, 'random-id', $object);
$result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = "random-id"');
- $this->assertEquals(array(
- 'etag' => md5($object),
- 'size' => strlen($object),
- 'calendardata' => $object,
+ $this->assertEquals([
+ 'etag' => md5($object),
+ 'size' => strlen($object),
+ 'calendardata' => $object,
'firstoccurence' => null,
- 'lastoccurence' => null,
- 'componenttype' => 'VTODO',
- ), $result->fetch(\PDO::FETCH_ASSOC));
+ 'lastoccurence' => null,
+ 'componenttype' => 'VTODO',
+ ], $result->fetch(\PDO::FETCH_ASSOC));
}
@@ -403,19 +403,19 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
function testGetCalendarObjects() {
$backend = new PDO($this->pdo);
- $returnedId = $backend->createCalendar('principals/user2','somerandomid',array());
+ $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []);
$object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n";
$backend->createCalendarObject($returnedId, 'random-id', $object);
- $data = $backend->getCalendarObjects($returnedId,'random-id');
+ $data = $backend->getCalendarObjects($returnedId, 'random-id');
$this->assertEquals(1, count($data));
$data = $data[0];
$this->assertEquals($returnedId, $data['calendarid']);
$this->assertEquals('random-id', $data['uri']);
- $this->assertEquals(strlen($object),$data['size']);
+ $this->assertEquals(strlen($object), $data['size']);
}
@@ -425,7 +425,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
function testGetCalendarObjectByUID() {
$backend = new PDO($this->pdo);
- $returnedId = $backend->createCalendar('principals/user2','somerandomid',[]);
+ $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []);
$object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nUID:foo\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n";
$backend->createCalendarObject($returnedId, 'random-id', $object);
@@ -446,14 +446,14 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
function testUpdateCalendarObject() {
$backend = new PDO($this->pdo);
- $returnedId = $backend->createCalendar('principals/user2','somerandomid',array());
+ $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []);
$object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n";
$object2 = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20130101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n";
$backend->createCalendarObject($returnedId, 'random-id', $object);
$backend->updateCalendarObject($returnedId, 'random-id', $object2);
- $data = $backend->getCalendarObject($returnedId,'random-id');
+ $data = $backend->getCalendarObject($returnedId, 'random-id');
$this->assertEquals($object2, $data['calendardata']);
$this->assertEquals($returnedId, $data['calendarid']);
@@ -468,13 +468,13 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
function testDeleteCalendarObject() {
$backend = new PDO($this->pdo);
- $returnedId = $backend->createCalendar('principals/user2','somerandomid',array());
+ $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []);
$object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n";
$backend->createCalendarObject($returnedId, 'random-id', $object);
$backend->deleteCalendarObject($returnedId, 'random-id');
- $data = $backend->getCalendarObject($returnedId,'random-id');
+ $data = $backend->getCalendarObject($returnedId, 'random-id');
$this->assertNull($data);
}
@@ -482,24 +482,24 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
function testCalendarQueryNoResult() {
$abstract = new PDO($this->pdo);
- $filters = array(
- 'name' => 'VCALENDAR',
- 'comp-filters' => array(
- array(
- 'name' => 'VJOURNAL',
- 'comp-filters' => array(),
- 'prop-filters' => array(),
+ $filters = [
+ 'name' => 'VCALENDAR',
+ 'comp-filters' => [
+ [
+ 'name' => 'VJOURNAL',
+ 'comp-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => null,
- ),
- ),
- 'prop-filters' => array(),
+ 'time-range' => null,
+ ],
+ ],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => null,
- );
+ 'time-range' => null,
+ ];
- $this->assertEquals(array(
- ), $abstract->calendarQuery(1, $filters));
+ $this->assertEquals([
+ ], $abstract->calendarQuery(1, $filters));
}
@@ -509,25 +509,25 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$backend->createCalendarObject(1, "todo", "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n");
$backend->createCalendarObject(1, "event", "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
- $filters = array(
- 'name' => 'VCALENDAR',
- 'comp-filters' => array(
- array(
- 'name' => 'VTODO',
- 'comp-filters' => array(),
- 'prop-filters' => array(),
+ $filters = [
+ 'name' => 'VCALENDAR',
+ 'comp-filters' => [
+ [
+ 'name' => 'VTODO',
+ 'comp-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => null,
- ),
- ),
- 'prop-filters' => array(),
+ 'time-range' => null,
+ ],
+ ],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => null,
- );
+ 'time-range' => null,
+ ];
- $this->assertEquals(array(
+ $this->assertEquals([
"todo",
- ), $backend->calendarQuery(1, $filters));
+ ], $backend->calendarQuery(1, $filters));
}
function testCalendarQueryTodoNotMatch() {
@@ -536,32 +536,32 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$backend->createCalendarObject(1, "todo", "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n");
$backend->createCalendarObject(1, "event", "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
- $filters = array(
- 'name' => 'VCALENDAR',
- 'comp-filters' => array(
- array(
- 'name' => 'VTODO',
- 'comp-filters' => array(),
- 'prop-filters' => array(
- array(
- 'name' => 'summary',
- 'text-match' => null,
- 'time-range' => null,
- 'param-filters' => array(),
+ $filters = [
+ 'name' => 'VCALENDAR',
+ 'comp-filters' => [
+ [
+ 'name' => 'VTODO',
+ 'comp-filters' => [],
+ 'prop-filters' => [
+ [
+ 'name' => 'summary',
+ 'text-match' => null,
+ 'time-range' => null,
+ 'param-filters' => [],
'is-not-defined' => false,
- ),
- ),
+ ],
+ ],
'is-not-defined' => false,
- 'time-range' => null,
- ),
- ),
- 'prop-filters' => array(),
+ 'time-range' => null,
+ ],
+ ],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => null,
- );
+ 'time-range' => null,
+ ];
- $this->assertEquals(array(
- ), $backend->calendarQuery(1, $filters));
+ $this->assertEquals([
+ ], $backend->calendarQuery(1, $filters));
}
@@ -571,13 +571,13 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$backend->createCalendarObject(1, "todo", "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n");
$backend->createCalendarObject(1, "event", "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
- $filters = array(
- 'name' => 'VCALENDAR',
- 'comp-filters' => array(),
- 'prop-filters' => array(),
+ $filters = [
+ 'name' => 'VCALENDAR',
+ 'comp-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => null,
- );
+ 'time-range' => null,
+ ];
$result = $backend->calendarQuery(1, $filters);
$this->assertTrue(in_array('todo', $result));
@@ -592,28 +592,28 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$backend->createCalendarObject(1, "event", "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
$backend->createCalendarObject(1, "event2", "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120103\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
- $filters = array(
- 'name' => 'VCALENDAR',
- 'comp-filters' => array(
- array(
- 'name' => 'VEVENT',
- 'comp-filters' => array(),
- 'prop-filters' => array(),
+ $filters = [
+ 'name' => 'VCALENDAR',
+ 'comp-filters' => [
+ [
+ 'name' => 'VEVENT',
+ 'comp-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => array(
+ 'time-range' => [
'start' => new \DateTime('20120103'),
'end' => new \DateTime('20120104'),
- ),
- ),
- ),
- 'prop-filters' => array(),
+ ],
+ ],
+ ],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => null,
- );
+ 'time-range' => null,
+ ];
- $this->assertEquals(array(
+ $this->assertEquals([
"event2",
- ), $backend->calendarQuery(1, $filters));
+ ], $backend->calendarQuery(1, $filters));
}
function testCalendarQueryTimeRangeNoEnd() {
@@ -623,28 +623,28 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$backend->createCalendarObject(1, "event", "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
$backend->createCalendarObject(1, "event2", "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20120103\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
- $filters = array(
- 'name' => 'VCALENDAR',
- 'comp-filters' => array(
- array(
- 'name' => 'VEVENT',
- 'comp-filters' => array(),
- 'prop-filters' => array(),
+ $filters = [
+ 'name' => 'VCALENDAR',
+ 'comp-filters' => [
+ [
+ 'name' => 'VEVENT',
+ 'comp-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => array(
+ 'time-range' => [
'start' => new \DateTime('20120102'),
- 'end' => null,
- ),
- ),
- ),
- 'prop-filters' => array(),
+ 'end' => null,
+ ],
+ ],
+ ],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => null,
- );
+ 'time-range' => null,
+ ];
- $this->assertEquals(array(
+ $this->assertEquals([
"event2",
- ), $backend->calendarQuery(1, $filters));
+ ], $backend->calendarQuery(1, $filters));
}
@@ -660,9 +660,9 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals([
'syncToken' => 1,
- 'modified' => [],
- 'deleted' => [],
- 'added' => [],
+ 'modified' => [],
+ 'deleted' => [],
+ 'added' => [],
], $result);
$currentToken = $result['syncToken'];
@@ -688,19 +688,19 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals([
'syncToken' => 6,
- 'modified' => [],
- 'deleted' => [],
- 'added' => ["todo1.ics", "todo3.ics"],
+ 'modified' => [],
+ 'deleted' => [],
+ 'added' => ["todo1.ics", "todo3.ics"],
], $result);
}
function testCreateSubscriptions() {
$props = [
- '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics', false),
- '{DAV:}displayname' => 'cal',
- '{http://apple.com/ns/ical/}refreshrate' => 'P1W',
- '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF',
+ '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics', false),
+ '{DAV:}displayname' => 'cal',
+ '{http://apple.com/ns/ical/}refreshrate' => 'P1W',
+ '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF',
'{http://calendarserver.org/ns/}subscribed-strip-todos' => true,
//'{http://calendarserver.org/ns/}subscribed-strip-alarms' => true,
'{http://calendarserver.org/ns/}subscribed-strip-attachments' => true,
@@ -720,7 +720,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$expected['source'] = 'http://example.org/cal.ics';
$this->assertEquals(1, count($subs));
- foreach($expected as $k=>$v) {
+ foreach ($expected as $k => $v) {
$this->assertEquals($subs[0][$k], $expected[$k]);
}
@@ -742,10 +742,10 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
function testUpdateSubscriptions() {
$props = [
- '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics', false),
- '{DAV:}displayname' => 'cal',
- '{http://apple.com/ns/ical/}refreshrate' => 'P1W',
- '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF',
+ '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics', false),
+ '{DAV:}displayname' => 'cal',
+ '{http://apple.com/ns/ical/}refreshrate' => 'P1W',
+ '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF',
'{http://calendarserver.org/ns/}subscribed-strip-todos' => true,
//'{http://calendarserver.org/ns/}subscribed-strip-alarms' => true,
'{http://calendarserver.org/ns/}subscribed-strip-attachments' => true,
@@ -755,7 +755,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$backend->createSubscription('principals/user1', 'sub1', $props);
$newProps = [
- '{DAV:}displayname' => 'new displayname',
+ '{DAV:}displayname' => 'new displayname',
'{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal2.ics', false),
];
@@ -776,7 +776,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$expected['source'] = 'http://example.org/cal2.ics';
$this->assertEquals(1, count($subs));
- foreach($expected as $k=>$v) {
+ foreach ($expected as $k => $v) {
$this->assertEquals($subs[0][$k], $expected[$k]);
}
@@ -785,10 +785,10 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
function testUpdateSubscriptionsFail() {
$props = [
- '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics', false),
- '{DAV:}displayname' => 'cal',
- '{http://apple.com/ns/ical/}refreshrate' => 'P1W',
- '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF',
+ '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics', false),
+ '{DAV:}displayname' => 'cal',
+ '{http://apple.com/ns/ical/}refreshrate' => 'P1W',
+ '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF',
'{http://calendarserver.org/ns/}subscribed-strip-todos' => true,
//'{http://calendarserver.org/ns/}subscribed-strip-alarms' => true,
'{http://calendarserver.org/ns/}subscribed-strip-attachments' => true,
@@ -798,17 +798,17 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$backend->createSubscription('principals/user1', 'sub1', $props);
$propPatch = new DAV\PropPatch([
- '{DAV:}displayname' => 'new displayname',
+ '{DAV:}displayname' => 'new displayname',
'{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal2.ics', false),
- '{DAV:}unknown' => 'foo',
+ '{DAV:}unknown' => 'foo',
]);
$backend->updateSubscription(1, $propPatch);
$propPatch->commit();
$this->assertEquals([
- '{DAV:}unknown' => 403,
- '{DAV:}displayname' => 424,
+ '{DAV:}unknown' => 403,
+ '{DAV:}displayname' => 424,
'{http://calendarserver.org/ns/}source' => 424,
], $propPatch->getResult());
@@ -817,10 +817,10 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
function testDeleteSubscriptions() {
$props = [
- '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics', false),
- '{DAV:}displayname' => 'cal',
- '{http://apple.com/ns/ical/}refreshrate' => 'P1W',
- '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF',
+ '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics', false),
+ '{DAV:}displayname' => 'cal',
+ '{http://apple.com/ns/ical/}refreshrate' => 'P1W',
+ '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF',
'{http://calendarserver.org/ns/}subscribed-strip-todos' => true,
//'{http://calendarserver.org/ns/}subscribed-strip-alarms' => true,
'{http://calendarserver.org/ns/}subscribed-strip-attachments' => true,
@@ -830,7 +830,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$backend->createSubscription('principals/user1', 'sub1', $props);
$newProps = [
- '{DAV:}displayname' => 'new displayname',
+ '{DAV:}displayname' => 'new displayname',
'{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal2.ics', false),
];
@@ -854,13 +854,13 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$expected = [
'calendardata' => $calData,
- 'uri' => 'schedule1.ics',
- 'etag' => '"' . md5($calData) . '"',
- 'size' => strlen($calData)
+ 'uri' => 'schedule1.ics',
+ 'etag' => '"' . md5($calData) . '"',
+ 'size' => strlen($calData)
];
$result = $backend->getSchedulingObject('principals/user1', 'schedule1.ics');
- foreach($expected as $k=>$v) {
+ foreach ($expected as $k => $v) {
$this->assertArrayHasKey($k, $result);
$this->assertEquals($v, $result[$k]);
}
@@ -869,7 +869,7 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals(1, count($results));
$result = $results[0];
- foreach($expected as $k=>$v) {
+ foreach ($expected as $k => $v) {
$this->assertEquals($v, $result[$k]);
}
diff --git a/tests/Sabre/CalDAV/Backend/AbstractTest.php b/tests/Sabre/CalDAV/Backend/AbstractTest.php
index 106ce1f..7f642ef 100644
--- a/tests/Sabre/CalDAV/Backend/AbstractTest.php
+++ b/tests/Sabre/CalDAV/Backend/AbstractTest.php
@@ -10,7 +10,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase {
function testUpdateCalendar() {
$abstract = new AbstractMock();
- $propPatch = new PropPatch( ['{DAV:}displayname' => 'anything'] );
+ $propPatch = new PropPatch(['{DAV:}displayname' => 'anything']);
$abstract->updateCalendar('randomid', $propPatch);
$result = $propPatch->commit();
@@ -22,25 +22,25 @@ class AbstractTest extends \PHPUnit_Framework_TestCase {
function testCalendarQuery() {
$abstract = new AbstractMock();
- $filters = array(
- 'name' => 'VCALENDAR',
- 'comp-filters' => array(
- array(
- 'name' => 'VEVENT',
- 'comp-filters' => array(),
- 'prop-filters' => array(),
+ $filters = [
+ 'name' => 'VCALENDAR',
+ 'comp-filters' => [
+ [
+ 'name' => 'VEVENT',
+ 'comp-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => null,
- ),
- ),
- 'prop-filters' => array(),
+ 'time-range' => null,
+ ],
+ ],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => null,
- );
+ 'time-range' => null,
+ ];
- $this->assertEquals(array(
+ $this->assertEquals([
'event1.ics',
- ), $abstract->calendarQuery(1, $filters));
+ ], $abstract->calendarQuery(1, $filters));
}
@@ -72,18 +72,18 @@ class AbstractTest extends \PHPUnit_Framework_TestCase {
]);
$expected = [
- array(
- 'id' => 1,
- 'calendarid' => 1,
- 'uri' => 'event1.ics',
+ [
+ 'id' => 1,
+ 'calendarid' => 1,
+ 'uri' => 'event1.ics',
'calendardata' => "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nUID:foo\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n",
- ),
- array(
- 'id' => 2,
- 'calendarid' => 1,
- 'uri' => 'task1.ics',
+ ],
+ [
+ 'id' => 2,
+ 'calendarid' => 1,
+ 'uri' => 'task1.ics',
'calendardata' => "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n",
- ),
+ ],
];
$this->assertEquals($expected, $result);
@@ -97,45 +97,45 @@ class AbstractMock extends AbstractBackend {
function getCalendarsForUser($principalUri) {
- return array(
- array(
- 'id' => 1,
- 'principaluri' => 'principal1',
- 'uri' => 'cal1',
- ),
- array(
- 'id' => 2,
+ return [
+ [
+ 'id' => 1,
'principaluri' => 'principal1',
+ 'uri' => 'cal1',
+ ],
+ [
+ 'id' => 2,
+ 'principaluri' => 'principal1',
'{http://sabredav.org/ns}owner-principal' => 'principal2',
- 'uri' => 'cal1',
- ),
- );
+ 'uri' => 'cal1',
+ ],
+ ];
}
- function createCalendar($principalUri,$calendarUri,array $properties) { }
+ function createCalendar($principalUri, $calendarUri, array $properties) { }
function deleteCalendar($calendarId) { }
function getCalendarObjects($calendarId) {
- switch($calendarId) {
+ switch ($calendarId) {
case 1:
return [
[
- 'id' => 1,
+ 'id' => 1,
'calendarid' => 1,
- 'uri' => 'event1.ics',
+ 'uri' => 'event1.ics',
],
[
- 'id' => 2,
+ 'id' => 2,
'calendarid' => 1,
- 'uri' => 'task1.ics',
+ 'uri' => 'task1.ics',
],
];
case 2:
return [
[
- 'id' => 3,
+ 'id' => 3,
'calendarid' => 2,
- 'uri' => 'shared-event.ics',
+ 'uri' => 'shared-event.ics',
]
];
}
@@ -144,35 +144,35 @@ class AbstractMock extends AbstractBackend {
function getCalendarObject($calendarId, $objectUri) {
- switch($objectUri) {
+ switch ($objectUri) {
case 'event1.ics' :
- return array(
- 'id' => 1,
- 'calendarid' => 1,
- 'uri' => 'event1.ics',
+ return [
+ 'id' => 1,
+ 'calendarid' => 1,
+ 'uri' => 'event1.ics',
'calendardata' => "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nUID:foo\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n",
- );
+ ];
case 'task1.ics' :
- return array(
- 'id' => 2,
- 'calendarid' => 1,
- 'uri' => 'task1.ics',
+ return [
+ 'id' => 2,
+ 'calendarid' => 1,
+ 'uri' => 'task1.ics',
'calendardata' => "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n",
- );
+ ];
case 'shared-event.ics' :
- return array(
- 'id' => 3,
- 'calendarid' => 2,
- 'uri' => 'event1.ics',
+ return [
+ 'id' => 3,
+ 'calendarid' => 2,
+ 'uri' => 'event1.ics',
'calendardata' => "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nUID:shared\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n",
- );
+ ];
}
}
- function createCalendarObject($calendarId,$objectUri,$calendarData) { }
- function updateCalendarObject($calendarId,$objectUri,$calendarData) { }
- function deleteCalendarObject($calendarId,$objectUri) { }
+ function createCalendarObject($calendarId, $objectUri, $calendarData) { }
+ function updateCalendarObject($calendarId, $objectUri, $calendarData) { }
+ function deleteCalendarObject($calendarId, $objectUri) { }
}
diff --git a/tests/Sabre/CalDAV/Backend/Mock.php b/tests/Sabre/CalDAV/Backend/Mock.php
index ea9384c..4412e55 100644
--- a/tests/Sabre/CalDAV/Backend/Mock.php
+++ b/tests/Sabre/CalDAV/Backend/Mock.php
@@ -1,6 +1,7 @@
<?php
namespace Sabre\CalDAV\Backend;
+
use Sabre\DAV;
use Sabre\CalDAV;
@@ -11,7 +12,7 @@ class Mock extends AbstractBackend {
function __construct(array $calendars = [], array $calendarData = []) {
- foreach($calendars as &$calendar) {
+ foreach ($calendars as &$calendar) {
if (!isset($calendar['id'])) {
$calendar['id'] = DAV\UUIDUtil::getUUID();
}
@@ -41,8 +42,8 @@ class Mock extends AbstractBackend {
*/
function getCalendarsForUser($principalUri) {
- $r = array();
- foreach($this->calendars as $row) {
+ $r = [];
+ foreach ($this->calendars as $row) {
if ($row['principaluri'] == $principalUri) {
$r[] = $row;
}
@@ -66,14 +67,14 @@ class Mock extends AbstractBackend {
* @param array $properties
* @return string|int
*/
- function createCalendar($principalUri,$calendarUri,array $properties) {
+ function createCalendar($principalUri, $calendarUri, array $properties) {
$id = DAV\UUIDUtil::getUUID();
$this->calendars[] = array_merge([
- 'id' => $id,
- 'principaluri' => $principalUri,
- 'uri' => $calendarUri,
- '{' . CalDAV\Plugin::NS_CALDAV . '}supported-calendar-component-set' => new CalDAV\Xml\Property\SupportedCalendarComponentSet(['VEVENT','VTODO']),
+ 'id' => $id,
+ 'principaluri' => $principalUri,
+ 'uri' => $calendarUri,
+ '{' . CalDAV\Plugin::NS_CALDAV . '}supported-calendar-component-set' => new CalDAV\Xml\Property\SupportedCalendarComponentSet(['VEVENT', 'VTODO']),
], $properties);
return $id;
@@ -86,9 +87,9 @@ class Mock extends AbstractBackend {
* @param string $calendarId
* @return void
*/
- public function deleteCalendar($calendarId) {
+ function deleteCalendar($calendarId) {
- foreach($this->calendars as $k=>$calendar) {
+ foreach ($this->calendars as $k => $calendar) {
if ($calendar['id'] === $calendarId) {
unset($this->calendars[$k]);
}
@@ -118,14 +119,14 @@ class Mock extends AbstractBackend {
* @param string $calendarId
* @return array
*/
- public function getCalendarObjects($calendarId) {
+ function getCalendarObjects($calendarId) {
if (!isset($this->calendarData[$calendarId]))
- return array();
+ return [];
$objects = $this->calendarData[$calendarId];
- foreach($objects as $uri => &$object) {
+ foreach ($objects as $uri => &$object) {
$object['calendarid'] = $calendarId;
$object['uri'] = $uri;
$object['lastmodified'] = null;
@@ -146,7 +147,7 @@ class Mock extends AbstractBackend {
* @param string $objectUri
* @return array
*/
- function getCalendarObject($calendarId,$objectUri) {
+ function getCalendarObject($calendarId, $objectUri) {
if (!isset($this->calendarData[$calendarId][$objectUri])) {
throw new DAV\Exception\NotFound('Object could not be found');
@@ -167,13 +168,13 @@ class Mock extends AbstractBackend {
* @param string $calendarData
* @return void
*/
- function createCalendarObject($calendarId,$objectUri,$calendarData) {
+ function createCalendarObject($calendarId, $objectUri, $calendarData) {
- $this->calendarData[$calendarId][$objectUri] = array(
+ $this->calendarData[$calendarId][$objectUri] = [
'calendardata' => $calendarData,
- 'calendarid' => $calendarId,
- 'uri' => $objectUri,
- );
+ 'calendarid' => $calendarId,
+ 'uri' => $objectUri,
+ ];
return '"' . md5($calendarData) . '"';
}
@@ -186,13 +187,13 @@ class Mock extends AbstractBackend {
* @param string $calendarData
* @return void
*/
- function updateCalendarObject($calendarId,$objectUri,$calendarData) {
+ function updateCalendarObject($calendarId, $objectUri, $calendarData) {
- $this->calendarData[$calendarId][$objectUri] = array(
+ $this->calendarData[$calendarId][$objectUri] = [
'calendardata' => $calendarData,
- 'calendarid' => $calendarId,
- 'uri' => $objectUri,
- );
+ 'calendarid' => $calendarId,
+ 'uri' => $objectUri,
+ ];
return '"' . md5($calendarData) . '"';
}
@@ -204,7 +205,7 @@ class Mock extends AbstractBackend {
* @param string $objectUri
* @return void
*/
- function deleteCalendarObject($calendarId,$objectUri) {
+ function deleteCalendarObject($calendarId, $objectUri) {
throw new Exception('Not implemented');
diff --git a/tests/Sabre/CalDAV/Backend/MockScheduling.php b/tests/Sabre/CalDAV/Backend/MockScheduling.php
index 52aad32..3ac22f4 100644
--- a/tests/Sabre/CalDAV/Backend/MockScheduling.php
+++ b/tests/Sabre/CalDAV/Backend/MockScheduling.php
@@ -1,8 +1,6 @@
<?php
namespace Sabre\CalDAV\Backend;
-use Sabre\DAV;
-use Sabre\CalDAV;
class MockScheduling extends Mock implements SchedulingSupport {
@@ -24,7 +22,7 @@ class MockScheduling extends Mock implements SchedulingSupport {
* @param string $objectUri
* @return array
*/
- public function getSchedulingObject($principalUri, $objectUri) {
+ function getSchedulingObject($principalUri, $objectUri) {
if (isset($this->schedulingObjects[$principalUri][$objectUri])) {
return $this->schedulingObjects[$principalUri][$objectUri];
@@ -43,7 +41,7 @@ class MockScheduling extends Mock implements SchedulingSupport {
* @param string $principalUri
* @return array
*/
- public function getSchedulingObjects($principalUri) {
+ function getSchedulingObjects($principalUri) {
if (isset($this->schedulingObjects[$principalUri])) {
return array_values($this->schedulingObjects[$principalUri]);
@@ -59,7 +57,7 @@ class MockScheduling extends Mock implements SchedulingSupport {
* @param string $objectUri
* @return void
*/
- public function deleteSchedulingObject($principalUri, $objectUri) {
+ function deleteSchedulingObject($principalUri, $objectUri) {
if (isset($this->schedulingObjects[$principalUri][$objectUri])) {
unset($this->schedulingObjects[$principalUri][$objectUri]);
@@ -75,17 +73,17 @@ class MockScheduling extends Mock implements SchedulingSupport {
* @param string $objectData;
* @return void
*/
- public function createSchedulingObject($principalUri, $objectUri, $objectData) {
+ function createSchedulingObject($principalUri, $objectUri, $objectData) {
if (!isset($this->schedulingObjects[$principalUri])) {
$this->schedulingObjects[$principalUri] = [];
}
$this->schedulingObjects[$principalUri][$objectUri] = [
- 'uri' => $objectUri,
+ 'uri' => $objectUri,
'calendardata' => $objectData,
'lastmodified' => null,
- 'etag' => '"' . md5($objectData) . '"',
- 'size' => strlen($objectData)
+ 'etag' => '"' . md5($objectData) . '"',
+ 'size' => strlen($objectData)
];
}
diff --git a/tests/Sabre/CalDAV/Backend/MockSharing.php b/tests/Sabre/CalDAV/Backend/MockSharing.php
index 2156627..b6caffe 100644
--- a/tests/Sabre/CalDAV/Backend/MockSharing.php
+++ b/tests/Sabre/CalDAV/Backend/MockSharing.php
@@ -47,7 +47,7 @@ class MockSharing extends Mock implements NotificationSupport, SharingSupport {
*/
function deleteNotification($principalUri, NotificationInterface $notification) {
- foreach($this->notifications[$principalUri] as $key=>$value) {
+ foreach ($this->notifications[$principalUri] as $key => $value) {
if ($notification === $value) {
unset($this->notifications[$principalUri][$key]);
}
@@ -84,12 +84,12 @@ class MockSharing extends Mock implements NotificationSupport, SharingSupport {
$this->shares[$calendarId] = [];
}
- foreach($add as $val) {
+ foreach ($add as $val) {
$val['status'] = CalDAV\SharingPlugin::STATUS_NORESPONSE;
$this->shares[$calendarId][] = $val;
}
- foreach($this->shares[$calendarId] as $k=>$share) {
+ foreach ($this->shares[$calendarId] as $k => $share) {
if (in_array($share['href'], $remove)) {
unset($this->shares[$calendarId][$k]);
@@ -153,7 +153,7 @@ class MockSharing extends Mock implements NotificationSupport, SharingSupport {
*/
function setPublishStatus($calendarId, $value) {
- foreach($this->calendars as $k=>$cal) {
+ foreach ($this->calendars as $k => $cal) {
if ($cal['id'] === $calendarId) {
if (!$value) {
unset($cal['{http://calendarserver.org/ns/}publish-url']);
@@ -169,4 +169,3 @@ class MockSharing extends Mock implements NotificationSupport, SharingSupport {
}
}
-
diff --git a/tests/Sabre/CalDAV/Backend/MockSubscriptionSupport.php b/tests/Sabre/CalDAV/Backend/MockSubscriptionSupport.php
index cab6265..729015e 100644
--- a/tests/Sabre/CalDAV/Backend/MockSubscriptionSupport.php
+++ b/tests/Sabre/CalDAV/Backend/MockSubscriptionSupport.php
@@ -1,6 +1,7 @@
<?php
namespace Sabre\CalDAV\Backend;
+
use Sabre\DAV;
use Sabre\CalDAV;
@@ -50,7 +51,7 @@ class MockSubscriptionSupport extends Mock implements SubscriptionSupport {
* @param string $principalUri
* @return array
*/
- public function getSubscriptionsForUser($principalUri) {
+ function getSubscriptionsForUser($principalUri) {
if (isset($this->subs[$principalUri])) {
return $this->subs[$principalUri];
@@ -70,7 +71,7 @@ class MockSubscriptionSupport extends Mock implements SubscriptionSupport {
* @param array $properties
* @return mixed
*/
- public function createSubscription($principalUri, $uri, array $properties) {
+ function createSubscription($principalUri, $uri, array $properties) {
$properties['uri'] = $uri;
$properties['principaluri'] = $principalUri;
@@ -80,7 +81,7 @@ class MockSubscriptionSupport extends Mock implements SubscriptionSupport {
$this->subs[$principalUri] = [];
}
- $id = [$principalUri, count($this->subs[$principalUri])+1];
+ $id = [$principalUri, count($this->subs[$principalUri]) + 1];
$properties['id'] = $id;
@@ -108,13 +109,13 @@ class MockSubscriptionSupport extends Mock implements SubscriptionSupport {
* @param \Sabre\DAV\PropPatch $propPatch
* @return void
*/
- public function updateSubscription($subscriptionId, DAV\PropPatch $propPatch) {
+ function updateSubscription($subscriptionId, DAV\PropPatch $propPatch) {
$found = null;
- foreach($this->subs[$subscriptionId[0]] as &$sub) {
+ foreach ($this->subs[$subscriptionId[0]] as &$sub) {
if ($sub['id'][1] === $subscriptionId[1]) {
- $found =& $sub;
+ $found = & $sub;
break;
}
@@ -123,7 +124,7 @@ class MockSubscriptionSupport extends Mock implements SubscriptionSupport {
if (!$found) return;
$propPatch->handleRemaining(function($mutations) use (&$found) {
- foreach($mutations as $k=>$v) {
+ foreach ($mutations as $k => $v) {
$found[$k] = $v;
}
return true;
@@ -137,10 +138,10 @@ class MockSubscriptionSupport extends Mock implements SubscriptionSupport {
* @param mixed $subscriptionId
* @return void
*/
- public function deleteSubscription($subscriptionId) {
+ function deleteSubscription($subscriptionId) {
$found = null;
- foreach($this->subs[$subscriptionId[0]] as $index=>$sub) {
+ foreach ($this->subs[$subscriptionId[0]] as $index => $sub) {
if ($sub['id'][1] === $subscriptionId[1]) {
unset($this->subs[$subscriptionId[0]][$index]);
diff --git a/tests/Sabre/CalDAV/Backend/PDOMySQLTest.php b/tests/Sabre/CalDAV/Backend/PDOMySQLTest.php
index fafb151..c215ca1 100644
--- a/tests/Sabre/CalDAV/Backend/PDOMySQLTest.php
+++ b/tests/Sabre/CalDAV/Backend/PDOMySQLTest.php
@@ -21,8 +21,8 @@ class PDOMySQLTest extends AbstractPDOTest {
file_get_contents(__DIR__ . '/../../../../examples/sql/mysql.calendars.sql')
);
- foreach($queries as $query) {
- $query = trim($query," \r\n\t");
+ foreach ($queries as $query) {
+ $query = trim($query, " \r\n\t");
if ($query)
$pdo->exec($query);
}
diff --git a/tests/Sabre/CalDAV/Backend/PDOSqliteTest.php b/tests/Sabre/CalDAV/Backend/PDOSqliteTest.php
index c8319c4..4074259 100644
--- a/tests/Sabre/CalDAV/Backend/PDOSqliteTest.php
+++ b/tests/Sabre/CalDAV/Backend/PDOSqliteTest.php
@@ -6,7 +6,7 @@ use Sabre\CalDAV;
require_once 'Sabre/CalDAV/Backend/AbstractPDOTest.php';
-class PDOSQLiteTest extends AbstractPDOTest {
+class PDOSqliteTest extends AbstractPDOTest {
function setup() {
@@ -16,11 +16,11 @@ class PDOSQLiteTest extends AbstractPDOTest {
unlink(SABRE_TEMPDIR . '/testdb.sqlite');
$pdo = new \PDO('sqlite:' . SABRE_TEMPDIR . '/testdb.sqlite');
- $pdo->setAttribute(\PDO::ATTR_ERRMODE,\PDO::ERRMODE_EXCEPTION);
+ $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
// Yup this is definitely not 'fool proof', but good enough for now.
$queries = explode(';', file_get_contents(__DIR__ . '/../../../../examples/sql/sqlite.calendars.sql'));
- foreach($queries as $query) {
+ foreach ($queries as $query) {
$pdo->exec($query);
}
$this->pdo = $pdo;
diff --git a/tests/Sabre/DAV/ServerRangeTest.php b/tests/Sabre/DAV/ServerRangeTest.php
index b745485..bafbef6 100644
--- a/tests/Sabre/DAV/ServerRangeTest.php
+++ b/tests/Sabre/DAV/ServerRangeTest.php
@@ -159,7 +159,7 @@ class ServerRangeTest extends \Sabre\DAVServerTest {
function testIfRangeEtag() {
$request = new HTTP\Request('GET', '/files/test.txt', [
- 'Range' => 'bytes=2-5',
+ 'Range' => 'bytes=2-5',
'If-Range' => '"' . md5('Test contents') . '"',
]);
$response = $this->request($request);
@@ -186,7 +186,7 @@ class ServerRangeTest extends \Sabre\DAVServerTest {
function testIfRangeEtagIncorrect() {
$request = new HTTP\Request('GET', '/files/test.txt', [
- 'Range' => 'bytes=2-5',
+ 'Range' => 'bytes=2-5',
'If-Range' => '"foobar"',
]);
$response = $this->request($request);
@@ -212,7 +212,7 @@ class ServerRangeTest extends \Sabre\DAVServerTest {
function testIfRangeModificationDate() {
$request = new HTTP\Request('GET', '/files/test.txt', [
- 'Range' => 'bytes=2-5',
+ 'Range' => 'bytes=2-5',
'If-Range' => 'tomorrow',
]);
$response = $this->request($request);
@@ -239,7 +239,7 @@ class ServerRangeTest extends \Sabre\DAVServerTest {
function testIfRangeModificationDateModified() {
$request = new HTTP\Request('GET', '/files/test.txt', [
- 'Range' => 'bytes=2-5',
+ 'Range' => 'bytes=2-5',
'If-Range' => '-2 years',
]);
$response = $this->request($request);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabredav.git
More information about the Pkg-owncloud-commits
mailing list