[Pkg-owncloud-commits] [php-sabredav] 21/34: Fixing unittest CS.

David Prévot taffit at moszumanska.debian.org
Wed May 27 13:57:10 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to tag 3.0.0-beta1
in repository php-sabredav.

commit 19631f9fcd26384440a409954655a1627e832afb
Author: Evert Pot <me at evertpot.com>
Date:   Mon May 25 18:10:18 2015 -0400

    Fixing unittest CS.
---
 tests/Sabre/DAV/Xml/Element/PropTest.php           |  6 +--
 tests/Sabre/DAV/Xml/Element/ResponseTest.php       | 34 +++++++--------
 tests/Sabre/DAV/Xml/Property/HrefTest.php          | 12 ++---
 tests/Sabre/DAV/Xml/Property/LastModifiedTest.php  |  2 +-
 tests/Sabre/DAV/Xml/Property/LockDiscoveryTest.php |  1 +
 .../DAV/Xml/Property/SupportedMethodSetTest.php    | 15 +++----
 .../DAV/Xml/Property/SupportedReportSetTest.php    | 51 +++++++++++-----------
 tests/Sabre/DAV/Xml/Request/PropFindTest.php       |  1 -
 tests/Sabre/DAV/Xml/Request/SyncCollectionTest.php |  3 +-
 9 files changed, 61 insertions(+), 64 deletions(-)

diff --git a/tests/Sabre/DAV/Xml/Element/PropTest.php b/tests/Sabre/DAV/Xml/Element/PropTest.php
index 457abc8..afa289a 100644
--- a/tests/Sabre/DAV/Xml/Element/PropTest.php
+++ b/tests/Sabre/DAV/Xml/Element/PropTest.php
@@ -90,7 +90,7 @@ XML;
             '{DAV:}foo' => function($reader) {
                 $reader->next();
                 return 'zim';
-            } 
+            }
         ];
 
         $this->assertDecodeProp($input, $expected, $elementMap);
@@ -112,7 +112,7 @@ XML;
         $expected = [];
 
         $elementMap = [
-            '{DAV:}foo' => 'idk?', 
+            '{DAV:}foo' => 'idk?',
         ];
 
         $this->assertDecodeProp($input, $expected, $elementMap);
@@ -134,7 +134,7 @@ XML;
         $expected = [];
 
         $elementMap = [
-            '{DAV:}foo' => new \StdClass(), 
+            '{DAV:}foo' => new \StdClass(),
         ];
 
         $this->assertDecodeProp($input, $expected, $elementMap);
diff --git a/tests/Sabre/DAV/Xml/Element/ResponseTest.php b/tests/Sabre/DAV/Xml/Element/ResponseTest.php
index 06866f0..47387fd 100644
--- a/tests/Sabre/DAV/Xml/Element/ResponseTest.php
+++ b/tests/Sabre/DAV/Xml/Element/ResponseTest.php
@@ -17,10 +17,10 @@ class ResponseTest extends DAV\Xml\XmlTest {
             ]
         ];
 
-        $property = new Response('uri',$innerProps);
+        $property = new Response('uri', $innerProps);
 
-        $this->assertEquals('uri',$property->getHref());
-        $this->assertEquals($innerProps,$property->getResponseProperties());
+        $this->assertEquals('uri', $property->getHref());
+        $this->assertEquals($innerProps, $property->getResponseProperties());
 
 
     }
@@ -39,7 +39,7 @@ class ResponseTest extends DAV\Xml\XmlTest {
             ]
         ];
 
-        $property = new Response('uri',$innerProps);
+        $property = new Response('uri', $innerProps);
 
         $xml = $this->write(['{DAV:}root' => ['{DAV:}response' => $property]]);
 
@@ -73,13 +73,13 @@ class ResponseTest extends DAV\Xml\XmlTest {
      */
     function testSerializeEmptyNamespace() {
 
-        $innerProps = [ 
-            200 => [ 
+        $innerProps = [
+            200 => [
                 '{}propertyname' => 'value',
             ],
         ];
 
-        $property = new Response('uri',$innerProps);
+        $property = new Response('uri', $innerProps);
 
         $xml = $this->write(['{DAV:}root' => ['{DAV:}response' => $property]]);
 
@@ -107,12 +107,12 @@ class ResponseTest extends DAV\Xml\XmlTest {
     function testSerializeCustomNamespace() {
 
         $innerProps = [
-            200 => [ 
+            200 => [
                 '{http://sabredav.org/NS/example}propertyname' => 'value',
             ],
         ];
 
-        $property = new Response('uri',$innerProps);
+        $property = new Response('uri', $innerProps);
         $xml = $this->write(['{DAV:}root' => ['{DAV:}response' => $property]]);
 
         $this->assertXmlStringEqualsXmlString(
@@ -136,13 +136,13 @@ class ResponseTest extends DAV\Xml\XmlTest {
      */
     function testSerializeComplexProperty() {
 
-        $innerProps = [ 
-            200 => [ 
+        $innerProps = [
+            200 => [
                 '{DAV:}link' => new DAV\Xml\Property\Href('http://sabredav.org/', false)
             ],
         ];
 
-        $property = new Response('uri',$innerProps);
+        $property = new Response('uri', $innerProps);
         $xml = $this->write(['{DAV:}root' => ['{DAV:}response' => $property]]);
 
         $this->assertXmlStringEqualsXmlString(
@@ -168,13 +168,13 @@ class ResponseTest extends DAV\Xml\XmlTest {
      */
     function testSerializeBreak() {
 
-        $innerProps = array(
-            200 => array(
+        $innerProps = [
+            200 => [
                 '{DAV:}link' => new \STDClass()
-            ),
-        );
+            ],
+        ];
 
-        $property = new Response('uri',$innerProps);
+        $property = new Response('uri', $innerProps);
         $this->write(['{DAV:}root' => ['{DAV:}response' => $property]]);
 
     }
diff --git a/tests/Sabre/DAV/Xml/Property/HrefTest.php b/tests/Sabre/DAV/Xml/Property/HrefTest.php
index e3a3bae..c7c2805 100644
--- a/tests/Sabre/DAV/Xml/Property/HrefTest.php
+++ b/tests/Sabre/DAV/Xml/Property/HrefTest.php
@@ -11,14 +11,14 @@ class HrefTest extends XmlTest {
     function testConstruct() {
 
         $href = new Href('path');
-        $this->assertEquals('path',$href->getHref());
+        $this->assertEquals('path', $href->getHref());
 
     }
 
     function testSerialize() {
 
         $href = new Href('path');
-        $this->assertEquals('path',$href->getHref());
+        $this->assertEquals('path', $href->getHref());
 
         $this->contextUri = '/bla/';
 
@@ -33,8 +33,8 @@ class HrefTest extends XmlTest {
 
     function testSerializeNoPrefix() {
 
-        $href = new Href('path',false);
-        $this->assertEquals('path',$href->getHref());
+        $href = new Href('path', false);
+        $this->assertEquals('path', $href->getHref());
 
         $xml = $this->write(['{DAV:}anything' => $href]);
 
@@ -57,7 +57,7 @@ class HrefTest extends XmlTest {
 
         $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $href);
 
-        $this->assertEquals('/bla/path',$href->getHref());
+        $this->assertEquals('/bla/path', $href->getHref());
 
     }
 
@@ -78,7 +78,7 @@ class HrefTest extends XmlTest {
     function testSerializeEntity() {
 
         $href = new Href('http://example.org/?a&b', false);
-        $this->assertEquals('http://example.org/?a&b',$href->getHref());
+        $this->assertEquals('http://example.org/?a&b', $href->getHref());
 
         $xml = $this->write(['{DAV:}anything' => $href]);
 
diff --git a/tests/Sabre/DAV/Xml/Property/LastModifiedTest.php b/tests/Sabre/DAV/Xml/Property/LastModifiedTest.php
index cd402b5..459fb28 100644
--- a/tests/Sabre/DAV/Xml/Property/LastModifiedTest.php
+++ b/tests/Sabre/DAV/Xml/Property/LastModifiedTest.php
@@ -6,7 +6,7 @@ use Sabre\DAV\Xml\XmlTest;
 use DateTime;
 use DateTimeZone;
 
-class GetLastModifiedTest extends XmlTest {
+class LastModifiedTest extends XmlTest {
 
     function testSerializeDateTime() {
 
diff --git a/tests/Sabre/DAV/Xml/Property/LockDiscoveryTest.php b/tests/Sabre/DAV/Xml/Property/LockDiscoveryTest.php
index ac21379..6567c72 100644
--- a/tests/Sabre/DAV/Xml/Property/LockDiscoveryTest.php
+++ b/tests/Sabre/DAV/Xml/Property/LockDiscoveryTest.php
@@ -4,6 +4,7 @@ namespace Sabre\DAV\Xml\Property;
 
 use Sabre\DAV\Xml\XmlTest;
 use Sabre\DAV\Locks\LockInfo;
+
 class LockDiscoveryTest extends XmlTest {
 
     function testSerialize() {
diff --git a/tests/Sabre/DAV/Xml/Property/SupportedMethodSetTest.php b/tests/Sabre/DAV/Xml/Property/SupportedMethodSetTest.php
index 39dea8e..f5fa330 100644
--- a/tests/Sabre/DAV/Xml/Property/SupportedMethodSetTest.php
+++ b/tests/Sabre/DAV/Xml/Property/SupportedMethodSetTest.php
@@ -33,22 +33,22 @@ class SupportedMethodSetTest extends DAV\AbstractServer {
 
         $this->sendPROPFIND($xml);
 
-        $this->assertEquals(207, $this->response->status,'We expected a multi-status response. Full response body: ' . $this->response->body);
+        $this->assertEquals(207, $this->response->status, 'We expected a multi-status response. Full response body: ' . $this->response->body);
 
-        $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/","xmlns\\1=\"urn:DAV\"",$this->response->body);
+        $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", "xmlns\\1=\"urn:DAV\"", $this->response->body);
         $xml = simplexml_load_string($body);
-        $xml->registerXPathNamespace('d','urn:DAV');
+        $xml->registerXPathNamespace('d', 'urn:DAV');
 
         $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop');
-        $this->assertEquals(1,count($data),'We expected 1 \'d:prop\' element');
+        $this->assertEquals(1, count($data), 'We expected 1 \'d:prop\' element');
 
         $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supported-method-set');
-        $this->assertEquals(1,count($data),'We expected 1 \'d:supported-method-set\' element');
+        $this->assertEquals(1, count($data), 'We expected 1 \'d:supported-method-set\' element');
 
         $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:status');
-        $this->assertEquals(1,count($data),'We expected 1 \'d:status\' element');
+        $this->assertEquals(1, count($data), 'We expected 1 \'d:status\' element');
 
-        $this->assertEquals('HTTP/1.1 200 OK',(string)$data[0],'The status for this property should have been 200');
+        $this->assertEquals('HTTP/1.1 200 OK', (string)$data[0], 'The status for this property should have been 200');
 
     }
 
@@ -60,4 +60,3 @@ class SupportedMethodSetTest extends DAV\AbstractServer {
     }
 
 }
-
diff --git a/tests/Sabre/DAV/Xml/Property/SupportedReportSetTest.php b/tests/Sabre/DAV/Xml/Property/SupportedReportSetTest.php
index 1866d5c..808b752 100644
--- a/tests/Sabre/DAV/Xml/Property/SupportedReportSetTest.php
+++ b/tests/Sabre/DAV/Xml/Property/SupportedReportSetTest.php
@@ -10,13 +10,13 @@ require_once 'Sabre/DAV/AbstractServer.php';
 
 class SupportedReportSetTest extends DAV\AbstractServer {
 
-    public function sendPROPFIND($body) {
+    function sendPROPFIND($body) {
 
-        $serverVars = array(
-            'REQUEST_URI'    => '/',
-            'REQUEST_METHOD' => 'PROPFIND',
+        $serverVars = [
+            'REQUEST_URI'         => '/',
+            'REQUEST_METHOD'      => 'PROPFIND',
             'HTTP_DEPTH'          => '0',
-        );
+        ];
 
         $request = HTTP\Sapi::createFromServerArray($serverVars);
         $request->setBody($body);
@@ -39,22 +39,22 @@ class SupportedReportSetTest extends DAV\AbstractServer {
 
         $this->sendPROPFIND($xml);
 
-        $this->assertEquals(207, $this->response->status,'We expected a multi-status response. Full response body: ' . $this->response->body);
+        $this->assertEquals(207, $this->response->status, 'We expected a multi-status response. Full response body: ' . $this->response->body);
 
-        $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/","xmlns\\1=\"urn:DAV\"",$this->response->body);
+        $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", "xmlns\\1=\"urn:DAV\"", $this->response->body);
         $xml = simplexml_load_string($body);
-        $xml->registerXPathNamespace('d','urn:DAV');
+        $xml->registerXPathNamespace('d', 'urn:DAV');
 
         $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop');
-        $this->assertEquals(1,count($data),'We expected 1 \'d:prop\' element');
+        $this->assertEquals(1, count($data), 'We expected 1 \'d:prop\' element');
 
         $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supported-report-set');
-        $this->assertEquals(1,count($data),'We expected 1 \'d:supported-report-set\' element');
+        $this->assertEquals(1, count($data), 'We expected 1 \'d:supported-report-set\' element');
 
         $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:status');
-        $this->assertEquals(1,count($data),'We expected 1 \'d:status\' element');
+        $this->assertEquals(1, count($data), 'We expected 1 \'d:status\' element');
 
-        $this->assertEquals('HTTP/1.1 200 OK',(string)$data[0],'The status for this property should have been 200');
+        $this->assertEquals('HTTP/1.1 200 OK', (string)$data[0], 'The status for this property should have been 200');
 
     }
 
@@ -69,7 +69,7 @@ class SupportedReportSetTest extends DAV\AbstractServer {
                 $prop->addReport('{http://www.rooftopsolutions.nl/testnamespace}myreport');
                 $prop->addReport('{DAV:}anotherreport');
             }
-        },200);
+        }, 200);
 
         $xml = '<?xml version="1.0"?>
 <d:propfind xmlns:d="DAV:">
@@ -80,37 +80,36 @@ class SupportedReportSetTest extends DAV\AbstractServer {
 
         $this->sendPROPFIND($xml);
 
-        $this->assertEquals(207, $this->response->status,'We expected a multi-status response. Full response body: ' . $this->response->body);
+        $this->assertEquals(207, $this->response->status, 'We expected a multi-status response. Full response body: ' . $this->response->body);
 
-        $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/","xmlns\\1=\"urn:DAV\"",$this->response->body);
+        $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", "xmlns\\1=\"urn:DAV\"", $this->response->body);
         $xml = simplexml_load_string($body);
-        $xml->registerXPathNamespace('d','urn:DAV');
-        $xml->registerXPathNamespace('x','http://www.rooftopsolutions.nl/testnamespace');
+        $xml->registerXPathNamespace('d', 'urn:DAV');
+        $xml->registerXPathNamespace('x', 'http://www.rooftopsolutions.nl/testnamespace');
 
         $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop');
-        $this->assertEquals(1,count($data),'We expected 1 \'d:prop\' element');
+        $this->assertEquals(1, count($data), 'We expected 1 \'d:prop\' element');
 
         $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supported-report-set');
-        $this->assertEquals(1,count($data),'We expected 1 \'d:supported-report-set\' element');
+        $this->assertEquals(1, count($data), 'We expected 1 \'d:supported-report-set\' element');
 
         $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supported-report-set/d:supported-report');
-        $this->assertEquals(2,count($data),'We expected 2 \'d:supported-report\' elements');
+        $this->assertEquals(2, count($data), 'We expected 2 \'d:supported-report\' elements');
 
         $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supported-report-set/d:supported-report/d:report');
-        $this->assertEquals(2,count($data),'We expected 2 \'d:report\' elements');
+        $this->assertEquals(2, count($data), 'We expected 2 \'d:report\' elements');
 
         $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supported-report-set/d:supported-report/d:report/x:myreport');
-        $this->assertEquals(1,count($data),'We expected 1 \'x:myreport\' element. Full body: ' . $this->response->body);
+        $this->assertEquals(1, count($data), 'We expected 1 \'x:myreport\' element. Full body: ' . $this->response->body);
 
         $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supported-report-set/d:supported-report/d:report/d:anotherreport');
-        $this->assertEquals(1,count($data),'We expected 1 \'d:anotherreport\' element. Full body: ' . $this->response->body);
+        $this->assertEquals(1, count($data), 'We expected 1 \'d:anotherreport\' element. Full body: ' . $this->response->body);
 
         $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:status');
-        $this->assertEquals(1,count($data),'We expected 1 \'d:status\' element');
+        $this->assertEquals(1, count($data), 'We expected 1 \'d:status\' element');
 
-        $this->assertEquals('HTTP/1.1 200 OK',(string)$data[0],'The status for this property should have been 200');
+        $this->assertEquals('HTTP/1.1 200 OK', (string)$data[0], 'The status for this property should have been 200');
 
     }
 
 }
-
diff --git a/tests/Sabre/DAV/Xml/Request/PropFindTest.php b/tests/Sabre/DAV/Xml/Request/PropFindTest.php
index 844fe7c..c11668b 100644
--- a/tests/Sabre/DAV/Xml/Request/PropFindTest.php
+++ b/tests/Sabre/DAV/Xml/Request/PropFindTest.php
@@ -46,4 +46,3 @@ class PropFindTest extends XmlTest {
 
 
 }
-
diff --git a/tests/Sabre/DAV/Xml/Request/SyncCollectionTest.php b/tests/Sabre/DAV/Xml/Request/SyncCollectionTest.php
index e33bdc5..6dfecc5 100644
--- a/tests/Sabre/DAV/Xml/Request/SyncCollectionTest.php
+++ b/tests/Sabre/DAV/Xml/Request/SyncCollectionTest.php
@@ -4,7 +4,7 @@ namespace Sabre\DAV\Xml\Request;
 
 use Sabre\DAV\Xml\XmlTest;
 
-class SyncCollectionReportTest extends XmlTest {
+class SyncCollectionTest extends XmlTest {
 
     function testDeserializeProp() {
 
@@ -92,4 +92,3 @@ class SyncCollectionReportTest extends XmlTest {
     }
 
 }
-

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