[packages/php-theseer-Autoload] run tests

glen glen at pld-linux.org
Wed May 21 20:17:29 CEST 2014


commit e88ebf818cea7fc5b28ff934963e319d74f09708
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Wed May 21 21:16:05 2014 +0300

    run tests
    
    code ripped from fedora php-theseer-autoload.spec

 php-theseer-Autoload.spec | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
---
diff --git a/php-theseer-Autoload.spec b/php-theseer-Autoload.spec
index 3d59e56..7ba6dda 100644
--- a/php-theseer-Autoload.spec
+++ b/php-theseer-Autoload.spec
@@ -1,3 +1,7 @@
+#
+# Conditional build:
+%bcond_without	tests		# build without tests
+
 %define		status		stable
 %define		pearname	Autoload
 %define		php_min_version 5.2.0
@@ -15,6 +19,10 @@ BuildRequires:	php-channel(pear.netpirates.net)
 BuildRequires:	php-pear-PEAR >= 1:1.8.0
 BuildRequires:	rpm-php-pearprov >= 4.4.2-11
 BuildRequires:	rpmbuild(macros) >= 1.610
+%if %{with tests}
+BuildRequires:	php-phpunit-PHPUnit
+BuildRequires:	php-theseer-DirectoryScanner >= 1.3.0
+%endif
 Requires:	php(core) >= %{php_min_version}
 Requires:	php(date)
 Requires:	php(spl)
@@ -43,6 +51,26 @@ In PEAR status of this package is: %{status}.
 %pear_package_setup
 mv docs/Autoload/* .
 
+# fixes for tests
+cd .%{php_pear_dir}/tests/%{pearname}
+mv tests/init.php{,.orig}
+cat <<EOF | tee tests/init.php
+<?php
+require 'TheSeer/DirectoryScanner/autoload.php';
+require 'TheSeer/Autoload/autoload.php';
+EOF
+
+%build
+%if %{with tests}
+cd .%{php_pear_dir}
+PEAR_DIR=$(pwd)
+cd tests/%{pearname}
+
+phpunit \
+	--include-path=$PEAR_DIR \
+	-d date.timezone=UTC
+%endif
+
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT{%{_bindir},%{php_pear_dir}}
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/php-theseer-Autoload.git/commitdiff/e88ebf818cea7fc5b28ff934963e319d74f09708



More information about the pld-cvs-commit mailing list