[Pkg-owncloud-commits] [php-sabredav] 01/30: CS fixes for Sabre\DAVACL

David Prévot taffit at moszumanska.debian.org
Tue Jan 26 16:19:39 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 7be69efec78d7973e3ee124f890e1d256d847c86
Author: Jakob Sack <mail at jakobsack.de>
Date:   Thu Jan 7 10:26:36 2016 +0100

    CS fixes for Sabre\DAVACL
    
    - Add missing parameters
    - remove unnecessary parameters
    - some string cleanups
---
 lib/DAVACL/Plugin.php                              |  3 +-
 lib/DAVACL/Xml/Property/SupportedPrivilegeSet.php  |  2 +-
 tests/Sabre/DAVACL/PluginAdminTest.php             | 43 ++++++++++------------
 tests/Sabre/DAVACL/PluginPropertiesTest.php        | 12 +++---
 .../Sabre/DAVACL/PrincipalBackend/PDOMySQLTest.php | 33 ++++++++++-------
 .../DAVACL/PrincipalBackend/PDOSqliteTest.php      | 15 +++++---
 tests/Sabre/DAVACL/PrincipalPropertySearchTest.php |  2 +-
 .../DAVACL/PrincipalSearchPropertySetTest.php      |  2 +-
 tests/Sabre/DAVACL/SimplePluginTest.php            |  8 ++--
 9 files changed, 62 insertions(+), 58 deletions(-)

diff --git a/lib/DAVACL/Plugin.php b/lib/DAVACL/Plugin.php
index 1240db0..601dffe 100644
--- a/lib/DAVACL/Plugin.php
+++ b/lib/DAVACL/Plugin.php
@@ -981,9 +981,10 @@ class Plugin extends DAV\ServerPlugin {
      *
      * @param string $reportName
      * @param mixed $report
+     * @param mixed $path
      * @return bool
      */
-    function report($reportName, $report) {
+    function report($reportName, $report, $path) {
 
         switch ($reportName) {
 
diff --git a/lib/DAVACL/Xml/Property/SupportedPrivilegeSet.php b/lib/DAVACL/Xml/Property/SupportedPrivilegeSet.php
index 7198946..572bed4 100644
--- a/lib/DAVACL/Xml/Property/SupportedPrivilegeSet.php
+++ b/lib/DAVACL/Xml/Property/SupportedPrivilegeSet.php
@@ -114,7 +114,7 @@ class SupportedPrivilegeSet implements XmlSerializable, HtmlOutput {
 
         ob_start();
         echo "<ul class=\"tree\">";
-        $traverse($this->getValue(), '');
+        $traverse($this->getValue());
         echo "</ul>\n";
 
         return ob_get_clean();
diff --git a/tests/Sabre/DAVACL/PluginAdminTest.php b/tests/Sabre/DAVACL/PluginAdminTest.php
index f824948..fb7516a 100644
--- a/tests/Sabre/DAVACL/PluginAdminTest.php
+++ b/tests/Sabre/DAVACL/PluginAdminTest.php
@@ -11,7 +11,9 @@ require_once 'Sabre/HTTP/ResponseMock.php';
 
 class PluginAdminTest extends \PHPUnit_Framework_TestCase {
 
-    function testNoAdminAccess() {
+    public $server;
+
+    function setUp() {
 
         $principalBackend = new PrincipalBackend\Mock();
 
@@ -20,12 +22,16 @@ class PluginAdminTest extends \PHPUnit_Framework_TestCase {
             new PrincipalCollection($principalBackend),
         );
 
-        $fakeServer = new DAV\Server($tree);
-        $fakeServer->sapi = new HTTP\SapiMock();
-        $plugin = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock(),'realm');
-        $fakeServer->addPlugin($plugin);
+        $this->server = new DAV\Server($tree);
+        $this->server->sapi = new HTTP\SapiMock();
+        $plugin = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock());
+        $this->server->addPlugin($plugin);
+    }
+
+    function testNoAdminAccess() {
+
         $plugin = new Plugin();
-        $fakeServer->addPlugin($plugin);
+        $this->server->addPlugin($plugin);
 
         $request = HTTP\Sapi::createFromServerArray(array(
             'REQUEST_METHOD' => 'OPTIONS',
@@ -35,10 +41,10 @@ class PluginAdminTest extends \PHPUnit_Framework_TestCase {
 
         $response = new HTTP\ResponseMock();
 
-        $fakeServer->httpRequest = $request;
-        $fakeServer->httpResponse = $response;
+        $this->server->httpRequest = $request;
+        $this->server->httpResponse = $response;
 
-        $fakeServer->exec();
+        $this->server->exec();
 
         $this->assertEquals(403, $response->status);
 
@@ -49,22 +55,11 @@ class PluginAdminTest extends \PHPUnit_Framework_TestCase {
      */
     function testAdminAccess() {
 
-        $principalBackend = new PrincipalBackend\Mock();
-
-        $tree = array(
-            new MockACLNode('adminonly', array()),
-            new PrincipalCollection($principalBackend),
-        );
-
-        $fakeServer = new DAV\Server($tree);
-        $fakeServer->sapi = new HTTP\SapiMock();
-        $plugin = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock(),'realm');
-        $fakeServer->addPlugin($plugin);
         $plugin = new Plugin();
         $plugin->adminPrincipals = array(
             'principals/admin',
         );
-        $fakeServer->addPlugin($plugin);
+        $this->server->addPlugin($plugin);
 
         $request = HTTP\Sapi::createFromServerArray(array(
             'REQUEST_METHOD' => 'OPTIONS',
@@ -74,10 +69,10 @@ class PluginAdminTest extends \PHPUnit_Framework_TestCase {
 
         $response = new HTTP\ResponseMock();
 
-        $fakeServer->httpRequest = $request;
-        $fakeServer->httpResponse = $response;
+        $this->server->httpRequest = $request;
+        $this->server->httpResponse = $response;
 
-        $fakeServer->exec();
+        $this->server->exec();
 
         $this->assertEquals(200, $response->status);
 
diff --git a/tests/Sabre/DAVACL/PluginPropertiesTest.php b/tests/Sabre/DAVACL/PluginPropertiesTest.php
index b3d6a17..e5b7e1a 100644
--- a/tests/Sabre/DAVACL/PluginPropertiesTest.php
+++ b/tests/Sabre/DAVACL/PluginPropertiesTest.php
@@ -43,7 +43,7 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase {
     function testCurrentUserPrincipal() {
 
         $fakeServer = new DAV\Server();
-        $plugin = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock(),'realm');
+        $plugin = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock());
         $fakeServer->addPlugin($plugin);
         $plugin = new Plugin();
         $fakeServer->addPlugin($plugin);
@@ -154,7 +154,7 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase {
 
         $server = new DAV\Server($nodes);
         $server->addPlugin($plugin);
-        $authPlugin = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock(),'realm');
+        $authPlugin = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock());
         $server->addPlugin($authPlugin);
 
         // Force login
@@ -192,7 +192,7 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase {
 
         $server = new DAV\Server($nodes);
         $server->addPlugin($plugin);
-        $authPlugin = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock(),'realm');
+        $authPlugin = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock());
         $server->addPlugin($authPlugin);
 
         // Force login
@@ -220,7 +220,7 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase {
         ];
 
         $fakeServer = new DAV\Server($tree);
-        //$plugin = new DAV\Auth\Plugin(new DAV\Auth\MockBackend(),'realm');
+        //$plugin = new DAV\Auth\Plugin(new DAV\Auth\MockBackend())
         //$fakeServer->addPlugin($plugin);
         $plugin = new Plugin();
         $fakeServer->addPlugin($plugin);
@@ -248,7 +248,7 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase {
         ];
 
         $fakeServer = new DAV\Server($tree);
-        //$plugin = new DAV\Auth\Plugin(new DAV\Auth\MockBackend(),'realm');
+        //$plugin = new DAV\Auth\Plugin(new DAV\Auth\MockBackend());
         //$fakeServer->addPlugin($plugin);
         $plugin = new Plugin();
         $fakeServer->addPlugin($plugin);
@@ -277,7 +277,7 @@ class PluginPropertiesTest extends \PHPUnit_Framework_TestCase {
         ];
 
         $fakeServer = new DAV\Server($tree);
-        //$plugin = new DAV\Auth\Plugin(new DAV\Auth\MockBackend(),'realm');
+        //$plugin = new DAV\Auth\Plugin(new DAV\Auth\MockBackend());
         //$fakeServer->addPlugin($plugin);
         $plugin = new Plugin();
         $fakeServer->addPlugin($plugin);
diff --git a/tests/Sabre/DAVACL/PrincipalBackend/PDOMySQLTest.php b/tests/Sabre/DAVACL/PrincipalBackend/PDOMySQLTest.php
index 84ba062..83353c8 100644
--- a/tests/Sabre/DAVACL/PrincipalBackend/PDOMySQLTest.php
+++ b/tests/Sabre/DAVACL/PrincipalBackend/PDOMySQLTest.php
@@ -16,25 +16,30 @@ class PDOMySQLTest extends AbstractPDOTest {
         $pdo = \Sabre\TestUtil::getMySQLDB();
         if (!$pdo) $this->markTestSkipped('Could not connect to MySQL database');
         $pdo->query("DROP TABLE IF EXISTS principals");
-        $pdo->query("
+        $pdo->query(<<<SQL
 create table principals (
-	id integer unsigned not null primary key auto_increment,
-	uri varchar(50),
-    email varchar(80),
-    displayname VARCHAR(80),
-    vcardurl VARCHAR(80),
-	unique(uri)
-);");
+  id integer unsigned not null primary key auto_increment,
+  uri varchar(50),
+  email varchar(80),
+  displayname VARCHAR(80),
+  vcardurl VARCHAR(80),
+  unique(uri)
+)
+SQL
+        );
 
         $pdo->query("INSERT INTO principals (uri,email,displayname) VALUES ('principals/user','user at example.org','User')");
         $pdo->query("INSERT INTO principals (uri,email,displayname) VALUES ('principals/group','group at example.org','Group')");
         $pdo->query("DROP TABLE IF EXISTS groupmembers");
-        $pdo->query("CREATE TABLE groupmembers (
-                id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
-                    principal_id INTEGER UNSIGNED NOT NULL,
-                        member_id INTEGER UNSIGNED NOT NULL,
-                            UNIQUE(principal_id, member_id)
-                        );");
+        $pdo->query(<<<SQL
+CREATE TABLE groupmembers (
+  id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+  principal_id INTEGER UNSIGNED NOT NULL,
+  member_id INTEGER UNSIGNED NOT NULL,
+  UNIQUE(principal_id, member_id)
+)
+SQL
+        );
 
         $pdo->query("INSERT INTO groupmembers (principal_id,member_id) VALUES (2,1)");
 
diff --git a/tests/Sabre/DAVACL/PrincipalBackend/PDOSqliteTest.php b/tests/Sabre/DAVACL/PrincipalBackend/PDOSqliteTest.php
index d3a3575..f335ed5 100644
--- a/tests/Sabre/DAVACL/PrincipalBackend/PDOSqliteTest.php
+++ b/tests/Sabre/DAVACL/PrincipalBackend/PDOSqliteTest.php
@@ -26,12 +26,15 @@ class PDOSQLiteTest extends AbstractPDOTest {
         $pdo->query('INSERT INTO principals VALUES (1, "principals/user","user at example.org","User")');
         $pdo->query('INSERT INTO principals VALUES (2, "principals/group","group at example.org","Group")');
 
-        $pdo->query("CREATE TABLE groupmembers (
-                id INTEGER PRIMARY KEY ASC,
-                principal_id INT,
-                member_id INT,
-                UNIQUE(principal_id, member_id)
-        );");
+        $pdo->query(<<<SQL
+CREATE TABLE groupmembers (
+  id INTEGER PRIMARY KEY ASC,
+  principal_id INT,
+  member_id INT,
+  UNIQUE(principal_id, member_id)
+)
+SQL
+        );
 
         $pdo->query("INSERT INTO groupmembers (principal_id,member_id) VALUES (2,1)");
 
diff --git a/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php b/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php
index 3227a4f..8e4c867 100644
--- a/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php
+++ b/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php
@@ -21,7 +21,7 @@ class PrincipalPropertySearchTest extends \PHPUnit_Framework_TestCase {
         $fakeServer->sapi = new HTTP\SapiMock();
         $fakeServer->httpResponse = new HTTP\ResponseMock();
         $fakeServer->debugExceptions = true;
-        $plugin = new MockPlugin($backend,'realm');
+        $plugin = new MockPlugin();
         $plugin->allowAccessToNodesWithoutACL = true;
 
         $this->assertTrue($plugin instanceof Plugin);
diff --git a/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php b/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php
index 12962fc..952dc17 100644
--- a/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php
+++ b/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php
@@ -20,7 +20,7 @@ class PrincipalSearchPropertySetTest extends \PHPUnit_Framework_TestCase {
         $fakeServer = new DAV\Server($dir);
         $fakeServer->sapi = new HTTP\SapiMock();
         $fakeServer->httpResponse = new HTTP\ResponseMock();
-        $plugin = new Plugin($backend,'realm');
+        $plugin = new Plugin();
         $this->assertTrue($plugin instanceof Plugin);
         $fakeServer->addPlugin($plugin);
         $this->assertEquals($plugin, $fakeServer->getPlugin('acl'));
diff --git a/tests/Sabre/DAVACL/SimplePluginTest.php b/tests/Sabre/DAVACL/SimplePluginTest.php
index 67c9240..fb73cc1 100644
--- a/tests/Sabre/DAVACL/SimplePluginTest.php
+++ b/tests/Sabre/DAVACL/SimplePluginTest.php
@@ -153,7 +153,7 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase {
         $server = new DAV\Server($tree);
         $server->addPlugin($acl);
 
-        $auth = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock(),'SabreDAV');
+        $auth = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock());
         $server->addPlugin($auth);
 
         //forcing login
@@ -180,7 +180,7 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase {
         $server = new DAV\Server($tree);
         $server->addPlugin($acl);
 
-        $auth = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock(),'SabreDAV');
+        $auth = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock());
         $server->addPlugin($auth);
 
         //forcing login
@@ -257,7 +257,7 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase {
         $aclPlugin = new Plugin();
         $server->addPlugin($aclPlugin);
 
-        $auth = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock(),'SabreDAV');
+        $auth = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock());
         $server->addPlugin($auth);
 
         //forcing login
@@ -311,7 +311,7 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase {
         $aclPlugin = new Plugin();
         $server->addPlugin($aclPlugin);
 
-        $auth = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock(),'SabreDAV');
+        $auth = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock());
         $server->addPlugin($auth);
 
         //forcing login

-- 
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