[Pkg-owncloud-commits] [php-sabredav] 144/148: Use homemade autoload.php for tests

David Prévot taffit at moszumanska.debian.org
Wed Apr 15 01:37:36 UTC 2015


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

taffit pushed a commit to branch master
in repository php-sabredav.

commit 8548b197ca04b35866a09fc680c7e3445bb88217
Author: David Prévot <taffit at debian.org>
Date:   Tue Apr 14 18:00:29 2015 -0400

    Use homemade autoload.php for tests
    
    Git-Dch: Ignore
---
 debian/autoload.tests.php.tpl                      | 22 ++++++
 debian/control                                     |  1 -
 .../patches/0001-Use-homemade-autoload.php.patch   | 22 ++----
 .../0002-Drop-Composer-autoLoader-calls.patch      | 28 ++++++++
 ...Loader-from-Symfony-instead-of-autoLoader.patch | 37 ----------
 .../0004-Allow-to-use-more-recent-sabre-http.patch | 23 ------
 ...tall-sabredav.php-in-usr-share-php-Sabre.patch} |  0
 debian/patches/0005-tfix-threshold.patch           | 84 ----------------------
 debian/patches/0006-tfix-selection.patch           | 23 ------
 .../Use-installed-class-for-DEP-8-tests.patch      | 22 ------
 debian/patches/series                              |  7 +-
 debian/rules                                       |  8 ++-
 debian/tests/control                               |  4 +-
 debian/tests/phpunit                               |  6 --
 14 files changed, 65 insertions(+), 222 deletions(-)

diff --git a/debian/autoload.tests.php.tpl b/debian/autoload.tests.php.tpl
new file mode 100644
index 0000000..9d7ebb9
--- /dev/null
+++ b/debian/autoload.tests.php.tpl
@@ -0,0 +1,22 @@
+<?php
+
+require_once 'Sabre/autoload.php';
+
+// @codingStandardsIgnoreFile
+// @codeCoverageIgnoreStart
+// this is an autogenerated file - do not edit
+spl_autoload_register(
+    function($class) {
+        static $classes = null;
+        if ($classes === null) {
+            $classes = array(
+                ___CLASSLIST___
+            );
+        }
+        $cn = strtolower($class);
+        if (isset($classes[$cn])) {
+            require ___BASEDIR___$classes[$cn];
+        }
+    }
+);
+// @codeCoverageIgnoreEnd
diff --git a/debian/control b/debian/control
index a733781..6532c71 100644
--- a/debian/control
+++ b/debian/control
@@ -12,7 +12,6 @@ Build-Depends: debhelper (>= 8.0.0),
                php-sabre-http (>= 4),
                php-sabre-vobject (>= 3.4.1),
                php-sabre-xml,
-               php-symfony-class-loader,
                php5-curl,
                php5-sqlite,
                phpab,
diff --git a/debian/patches/0001-Use-homemade-autoload.php.patch b/debian/patches/0001-Use-homemade-autoload.php.patch
index e7a56f1..f6b9c74 100644
--- a/debian/patches/0001-Use-homemade-autoload.php.patch
+++ b/debian/patches/0001-Use-homemade-autoload.php.patch
@@ -17,11 +17,10 @@ Forwarded: not-needed
  examples/fileserver.php        | 2 +-
  examples/groupwareserver.php   | 2 +-
  examples/simplefsserver.php    | 6 +-----
- tests/bootstrap.php            | 2 +-
- 12 files changed, 20 insertions(+), 24 deletions(-)
+ 11 files changed, 19 insertions(+), 23 deletions(-)
 
 diff --git a/bin/build.php b/bin/build.php
-index f861138..79336d1 100755
+index a6d5b98..1e64520 100755
 --- a/bin/build.php
 +++ b/bin/build.php
 @@ -1,4 +1,4 @@
@@ -40,7 +39,7 @@ index f861138..79336d1 100755
      }
  
 diff --git a/bin/migrateto17.php b/bin/migrateto17.php
-index 66a9ee5..00f0d08 100755
+index 3ccf0a3..5716162 100755
 --- a/bin/migrateto17.php
 +++ b/bin/migrateto17.php
 @@ -1,4 +1,4 @@
@@ -103,7 +102,7 @@ index c0cef52..c83ad3c 100755
  
  foreach($paths as $path) {
 diff --git a/bin/naturalselection b/bin/naturalselection
-index aa5554d..8ccd33b 100755
+index 1488ef2..eaa55a4 100755
 --- a/bin/naturalselection
 +++ b/bin/naturalselection
 @@ -1,4 +1,4 @@
@@ -202,16 +201,3 @@ index cf64730..f0bf08e 100644
  
  class MyCollection extends Sabre\DAV\Collection {
  
-diff --git a/tests/bootstrap.php b/tests/bootstrap.php
-index e254236..7ddbef2 100644
---- a/tests/bootstrap.php
-+++ b/tests/bootstrap.php
-@@ -2,7 +2,7 @@
- 
- set_include_path(__DIR__ . '/../lib/' . PATH_SEPARATOR . __DIR__ . PATH_SEPARATOR . get_include_path());
- 
--$autoLoader = include __DIR__ . '/../vendor/autoload.php';
-+$autoLoader = include __DIR__ . '/../lib/autoload.php';
- 
- // SabreDAV tests auto loading
- $autoLoader->add('Sabre\\', __DIR__);
diff --git a/debian/patches/0002-Drop-Composer-autoLoader-calls.patch b/debian/patches/0002-Drop-Composer-autoLoader-calls.patch
new file mode 100644
index 0000000..ebfdb24
--- /dev/null
+++ b/debian/patches/0002-Drop-Composer-autoLoader-calls.patch
@@ -0,0 +1,28 @@
+From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit at debian.org>
+Date: Tue, 20 May 2014 14:56:49 -0400
+Subject: Drop Composer autoLoader calls
+
+Work around the lack of proper autoload.php from Composer by using a
+static ClassLoader made by PHPAB.
+
+Forwarded: not-needed
+---
+ tests/bootstrap.php | 5 -----
+ 1 file changed, 5 deletions(-)
+
+diff --git a/tests/bootstrap.php b/tests/bootstrap.php
+index fdbfb99..7da7881 100644
+--- a/tests/bootstrap.php
++++ b/tests/bootstrap.php
+@@ -4,11 +4,6 @@ set_include_path(__DIR__ . '/../lib/' . PATH_SEPARATOR . __DIR__ . PATH_SEPARATO
+ 
+ $autoLoader = include __DIR__ . '/../vendor/autoload.php';
+ 
+-// SabreDAV tests auto loading
+-$autoLoader->add('Sabre\\', __DIR__);
+-// VObject tests auto loading
+-$autoLoader->addPsr4('Sabre\\VObject\\',__DIR__ . '/../vendor/sabre/vobject/tests/VObject');
+-
+ date_default_timezone_set('UTC');
+ 
+ $config = [
diff --git a/debian/patches/0002-Use-ClassLoader-from-Symfony-instead-of-autoLoader.patch b/debian/patches/0002-Use-ClassLoader-from-Symfony-instead-of-autoLoader.patch
deleted file mode 100644
index bcb8faa..0000000
--- a/debian/patches/0002-Use-ClassLoader-from-Symfony-instead-of-autoLoader.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit at debian.org>
-Date: Tue, 20 May 2014 14:56:49 -0400
-Subject: Use ClassLoader from Symfony instead of autoLoader
-
-Work around the lack of proper autoload.php from Composer by using the
-ClassLoader element from Symfony.
-
-http://symfony.com/doc/current/components/class_loader/class_loader.html
-
-Forwarded: not-needed
----
- tests/bootstrap.php | 12 ++++++++----
- 1 file changed, 8 insertions(+), 4 deletions(-)
-
-diff --git a/tests/bootstrap.php b/tests/bootstrap.php
-index 7ddbef2..4fdfec2 100644
---- a/tests/bootstrap.php
-+++ b/tests/bootstrap.php
-@@ -4,10 +4,14 @@ set_include_path(__DIR__ . '/../lib/' . PATH_SEPARATOR . __DIR__ . PATH_SEPARATO
- 
- $autoLoader = include __DIR__ . '/../lib/autoload.php';
- 
--// SabreDAV tests auto loading
--$autoLoader->add('Sabre\\', __DIR__);
--// VObject tests auto loading
--$autoLoader->addPsr4('Sabre\\VObject\\',__DIR__ . '/../vendor/sabre/vobject/tests/VObject');
-+require_once 'Symfony/Component/ClassLoader/ClassLoader.php';
-+use Symfony\Component\ClassLoader\ClassLoader;
-+$loader = new ClassLoader();
-+//$loader->setUseIncludePath(true);
-+$loader->register();
-+$loader->addPrefixes(array(
-+	'Sabre' => __DIR__,
-+));
- 
- 
- date_default_timezone_set('UTC');
diff --git a/debian/patches/0004-Allow-to-use-more-recent-sabre-http.patch b/debian/patches/0004-Allow-to-use-more-recent-sabre-http.patch
deleted file mode 100644
index b833070..0000000
--- a/debian/patches/0004-Allow-to-use-more-recent-sabre-http.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit at debian.org>
-Date: Thu, 26 Feb 2015 10:54:19 -0400
-Subject: Allow to use more recent sabre/http
-
-Forwarded: https://github.com/fruux/sabre-dav/pull/614
-Applied-Upstream: https://github.com/fruux/sabre-dav/commit/d965ba78540f8a4d42be27406ef78959caef4aec
----
- composer.json | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/composer.json b/composer.json
-index 7eb19d5..2ad7688 100644
---- a/composer.json
-+++ b/composer.json
-@@ -17,7 +17,7 @@
-         "php": ">=5.4.1",
-         "sabre/vobject": "~3.3",
-         "sabre/event" : "~2.0.0",
--        "sabre/http" : "4.0.0-alpha1",
-+        "sabre/http" : "~4.0.0-alpha1",
-         "sabre/uri" : "~1.0",
-         "ext-dom": "*",
-         "ext-pcre": "*",
diff --git a/debian/patches/0007-Install-sabredav.php-in-usr-share-php-Sabre.patch b/debian/patches/0004-Install-sabredav.php-in-usr-share-php-Sabre.patch
similarity index 100%
rename from debian/patches/0007-Install-sabredav.php-in-usr-share-php-Sabre.patch
rename to debian/patches/0004-Install-sabredav.php-in-usr-share-php-Sabre.patch
diff --git a/debian/patches/0005-tfix-threshold.patch b/debian/patches/0005-tfix-threshold.patch
deleted file mode 100644
index af405bb..0000000
--- a/debian/patches/0005-tfix-threshold.patch
+++ /dev/null
@@ -1,84 +0,0 @@
-From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit at debian.org>
-Date: Thu, 26 Feb 2015 13:40:12 -0400
-Subject: tfix: threshold
-
-Forwarded: https://github.com/fruux/sabre-dav/pull/615
-Applied-Upstream: https://github.com/fruux/sabre-dav/commit/60a1e4e70e315a1098712e43e7f16b196abd0b12
----
- bin/naturalselection | 26 +++++++++++++-------------
- 1 file changed, 13 insertions(+), 13 deletions(-)
-
-diff --git a/bin/naturalselection b/bin/naturalselection
-index 8ccd33b..086722a 100755
---- a/bin/naturalselection
-+++ b/bin/naturalselection
-@@ -16,16 +16,16 @@ def getfreespace(path):
-     stat = os.statvfs(path)
-     return stat.f_frsize * stat.f_bavail
- 
--def getbytesleft(path,treshold):
--    return getfreespace(path)-treshold
-+def getbytesleft(path,threshold):
-+    return getfreespace(path)-threshold
- 
--def run(cacheDir, treshold, sleep=5, simulate=False, min_erase = 0):
-+def run(cacheDir, threshold, sleep=5, simulate=False, min_erase = 0):
- 
--    bytes = getbytesleft(cacheDir,treshold)
-+    bytes = getbytesleft(cacheDir,threshold)
-     if (bytes>0):
--        print "Bytes to go before we hit treshhold:", bytes
-+        print "Bytes to go before we hit threshold:", bytes
-     else:
--        print "Treshold exceeded with:", -bytes, "bytes"
-+        print "Threshold exceeded with:", -bytes, "bytes"
-         dir = os.listdir(cacheDir)
-         dir2 = []
-         for file in dir:
-@@ -46,7 +46,7 @@ def run(cacheDir, treshold, sleep=5, simulate=False, min_erase = 0):
-         left = min_erase
- 
-         # If the min_erase setting is lower than the amount of bytes over
--        # the treshold, we use that number instead.
-+        # the threshold, we use that number instead.
-         if left < -bytes :
-             left = -bytes
- 
-@@ -73,7 +73,7 @@ def run(cacheDir, treshold, sleep=5, simulate=False, min_erase = 0):
- def main():
-     parser = OptionParser(
-         version="naturalselecton v0.3",
--        description="Cache directory manager. Deletes cache entries based on accesstime and free space tresholds.\n" +
-+        description="Cache directory manager. Deletes cache entries based on accesstime and free space thresholds.\n" +
-             "This utility is distributed alongside SabreDAV.",
-         usage="usage: %prog [options] cacheDirectory",
-     )
-@@ -98,15 +98,15 @@ def main():
-         default=5
-     )
-     parser.add_option(
--        '-l','--treshold',
--        help="Treshhold in bytes (default = 10737418240, which is 10GB)",
-+        '-l','--threshold',
-+        help="Threshold in bytes (default = 10737418240, which is 10GB)",
-         type="int",
--        dest="treshold",
-+        dest="threshold",
-         default=10737418240
-     )
-     parser.add_option(
-         '-m', '--min-erase',
--        help="Minimum number of bytes to erase when the treshold is reached. " +
-+        help="Minimum number of bytes to erase when the threshold is reached. " +
-             "Setting this option higher will reduce the amount of times the cache directory will need to be scanned. " +
-             "(the default is 1073741824, which is 1GB.)",
-         type="int",
-@@ -130,7 +130,7 @@ def main():
-             cacheDir,
-             sleep=options.sleep,
-             simulate=options.simulate,
--            treshold=options.treshold,
-+            threshold=options.threshold,
-             min_erase=options.min_erase
-         )
-         if runs>0:
diff --git a/debian/patches/0006-tfix-selection.patch b/debian/patches/0006-tfix-selection.patch
deleted file mode 100644
index d4622e0..0000000
--- a/debian/patches/0006-tfix-selection.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit at debian.org>
-Date: Thu, 26 Feb 2015 13:56:46 -0400
-Subject: tfix: selection
-
-Forwarded: https://github.com/fruux/sabre-dav/pull/615
-Applied-Upstream: https://github.com/fruux/sabre-dav/commit/60a1e4e70e315a1098712e43e7f16b196abd0b12
----
- bin/naturalselection | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/bin/naturalselection b/bin/naturalselection
-index 086722a..eaa55a4 100755
---- a/bin/naturalselection
-+++ b/bin/naturalselection
-@@ -72,7 +72,7 @@ def run(cacheDir, threshold, sleep=5, simulate=False, min_erase = 0):
- 
- def main():
-     parser = OptionParser(
--        version="naturalselecton v0.3",
-+        version="naturalselection v0.3",
-         description="Cache directory manager. Deletes cache entries based on accesstime and free space thresholds.\n" +
-             "This utility is distributed alongside SabreDAV.",
-         usage="usage: %prog [options] cacheDirectory",
diff --git a/debian/patches/DEP-8/Use-installed-class-for-DEP-8-tests.patch b/debian/patches/DEP-8/Use-installed-class-for-DEP-8-tests.patch
deleted file mode 100644
index 01a8424..0000000
--- a/debian/patches/DEP-8/Use-installed-class-for-DEP-8-tests.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit at debian.org>
-Date: Thu, 26 Feb 2015 10:18:08 -0400
-Subject: Use installed class for DEP-8 tests
-
-Gbp: Topic DEP-8
----
- tests/bootstrap.php | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tests/bootstrap.php b/tests/bootstrap.php
-index 4fdfec2..e01e9d3 100644
---- a/tests/bootstrap.php
-+++ b/tests/bootstrap.php
-@@ -2,7 +2,7 @@
- 
- set_include_path(__DIR__ . '/../lib/' . PATH_SEPARATOR . __DIR__ . PATH_SEPARATOR . get_include_path());
- 
--$autoLoader = include __DIR__ . '/../lib/autoload.php';
-+$autoLoader = include 'Sabre/autoload.php';
- 
- require_once 'Symfony/Component/ClassLoader/ClassLoader.php';
- use Symfony\Component\ClassLoader\ClassLoader;
diff --git a/debian/patches/series b/debian/patches/series
index a90a5c7..855acbf 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,7 +1,4 @@
 0001-Use-homemade-autoload.php.patch
-0002-Use-ClassLoader-from-Symfony-instead-of-autoLoader.patch
+0002-Drop-Composer-autoLoader-calls.patch
 0003-Increase-timeout.patch
-0004-Allow-to-use-more-recent-sabre-http.patch
-0005-tfix-threshold.patch
-0006-tfix-selection.patch
-0007-Install-sabredav.php-in-usr-share-php-Sabre.patch
+0004-Install-sabredav.php-in-usr-share-php-Sabre.patch
diff --git a/debian/rules b/debian/rules
index 51626c3..997ca78 100755
--- a/debian/rules
+++ b/debian/rules
@@ -10,9 +10,15 @@ override_dh_auto_build:
 	phpab	--output lib/autoload.php \
 		--template debian/autoload.php.tpl \
 		lib
+	mkdir --parents vendor
+	phpab \
+		--output vendor/autoload.php \
+		--basedir vendor \
+		--template debian/autoload.php.tpl \
+		lib tests/Sabre
 
 override_dh_auto_clean:
-	rm -rf tests/temp
+	rm -rf tests/temp vendor
 	dh_auto_clean
 
 override_dh_auto_test:
diff --git a/debian/tests/control b/debian/tests/control
index 191a840..8d58c9c 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -1,6 +1,6 @@
 Test-Command: phpcs -p --standard=tests/phpcs/ruleset.xml /usr/share/php/Sabre/*DAV*
 Depends: @, php-codesniffer
 
-Tests: phpunit
+Test-Command: mkdir --parents vendor && phpab --output vendor/autoload.php --basedir vendor --template debian/autoload.tests.php.tpl tests/Sabre && phpunit --configuration tests/phpunit.xml
 Restrictions: rw-build-tree
-Depends: @, patch, php-symfony-class-loader, php5-curl, php5-sqlite, phpunit
+Depends: @, php5-curl, php5-sqlite, phpab, phpunit
diff --git a/debian/tests/phpunit b/debian/tests/phpunit
deleted file mode 100755
index f6c532e..0000000
--- a/debian/tests/phpunit
+++ /dev/null
@@ -1,6 +0,0 @@
-#! /bin/sh
-patch -p1 < debian/patches/DEP-8/Use-installed-class-for-DEP-8-tests.patch
-phpunit --configuration tests/phpunit.xml
-exit=$?
-patch -Rp1 < debian/patches/DEP-8/Use-installed-class-for-DEP-8-tests.patch
-exit $exit

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