[php-phpunit-PHP-CodeCoverage] initial import

Remi Collet remi at fedoraproject.org
Wed Nov 3 13:28:13 UTC 2010


commit 07b6131bd94a798113569f767d0b981fbc03b3e6
Author: remi <fedora at famillecollet.com>
Date:   Wed Nov 3 14:28:01 2010 +0100

    initial import

 .gitignore                        |    2 +
 README.markdown                   |   87 ++++++++++++++++++++++++++++++++++
 php-phpunit-PHP-CodeCoverage.spec |   94 +++++++++++++++++++++++++++++++++++++
 sources                           |    1 +
 4 files changed, 184 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..3963dcf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1,2 @@
+/PHP_CodeCoverage-1.0.0.tgz
+package.xml
diff --git a/README.markdown b/README.markdown
new file mode 100644
index 0000000..1ca62a4
--- /dev/null
+++ b/README.markdown
@@ -0,0 +1,87 @@
+PHP_CodeCoverage
+================
+
+**PHP_CodeCoverage** is a library that provides collection, processing, and rendering functionality for PHP code coverage information.
+
+Installation
+------------
+
+PHP_CodeCoverage should be installed using the [PEAR Installer](http://pear.php.net/). This installer is the backbone of PEAR, which provides a distribution system for PHP packages, and is shipped with every release of PHP since version 4.3.0.
+
+The PEAR channel (`pear.phpunit.de`) that is used to distribute PHP_CodeCoverage needs to be registered with the local PEAR environment. Furthermore, a component that PHP_CodeCoverage depends upon is hosted on the eZ Components PEAR channel (`components.ez.no`).
+
+    sb at ubuntu ~ % pear channel-discover pear.phpunit.de
+    Adding Channel "pear.phpunit.de" succeeded
+    Discovery of channel "pear.phpunit.de" succeeded
+
+    sb at ubuntu ~ % pear channel-discover components.ez.no
+    Adding Channel "components.ez.no" succeeded
+    Discovery of channel "components.ez.no" succeeded
+
+This has to be done only once. Now the PEAR Installer can be used to install packages from the PHPUnit channel:
+
+    sb at vmware ~ % pear install phpunit/PHP_CodeCoverage
+    downloading PHP_CodeCoverage-0.9.0.tgz ...
+    Starting to download PHP_CodeCoverage-0.9.0.tgz (108,376 bytes)
+    .........................done: 108,376 bytes
+    install ok: channel://pear.phpunit.de/PHP_CodeCoverage-0.9.0
+
+After the installation you can find the PHP_CodeCoverage source files inside your local PEAR directory; the path is usually `/usr/lib/php/PHP/CodeCoverage`.
+
+Using the PHP_CodeCoverage API
+------------------------------
+
+    <?php
+    require_once 'PHP/CodeCoverage.php';
+    require_once 'PHP/CodeCoverage/Report/Clover.php';
+    require_once 'PHP/CodeCoverage/Report/HTML.php';
+
+    $coverage = new PHP_CodeCoverage;
+    $coverage->start('<name of test>');
+
+    // ...
+
+    $coverage->stop();
+
+    $writer = new PHP_CodeCoverage_Report_Clover;
+    $writer->process($coverage, '/tmp/clover.xml');
+
+    $writer = new PHP_CodeCoverage_Report_HTML;
+    $writer->process($coverage, '/tmp/code-coverage-report');
+
+Using the `phpcov` tool
+-----------------------
+
+    sb at vmware examples % cat add.php
+    <?php
+    $a = 1;
+    $b = 2;
+    print $a + $b;
+
+    sb at vmware examples % phpcov --clover clover.xml add.php
+    phpcov 0.9.0 by Sebastian Bergmann.
+
+    3
+
+    sb at vmware examples % cat clover.xml
+    <?xml version="1.0" encoding="UTF-8"?>
+    <coverage generated="1270365900">
+      <project timestamp="1270365900">
+        <file name="/usr/local/src/bytekit-cli/examples/add.php">
+          <line num="2" type="stmt" count="1"/>
+          <line num="3" type="stmt" count="1"/>
+          <line num="4" type="stmt" count="1"/>
+          <line num="5" type="stmt" count="1"/>
+          <metrics loc="4" ncloc="4" classes="0" methods="0"
+                   coveredmethods="0" conditionals="0"
+                   coveredconditionals="0" statements="4"
+                   coveredstatements="4" elements="4"
+                   coveredelements="4"/>
+        </file>
+        <metrics files="1" loc="4" ncloc="4" classes="0" methods="0"
+                 coveredmethods="0" conditionals="0"
+                 coveredconditionals="0" statements="4"
+                 coveredstatements="4" elements="4"
+                 coveredelements="4"/>
+      </project>
+    </coverage>
diff --git a/php-phpunit-PHP-CodeCoverage.spec b/php-phpunit-PHP-CodeCoverage.spec
new file mode 100644
index 0000000..ade8c17
--- /dev/null
+++ b/php-phpunit-PHP-CodeCoverage.spec
@@ -0,0 +1,94 @@
+%{!?__pear: %{expand: %%global __pear %{_bindir}/pear}}
+%global pear_name PHP_CodeCoverage
+%global channel pear.phpunit.de
+
+Name:           php-phpunit-PHP-CodeCoverage
+Version:        1.0.0
+Release:        1%{?dist}
+Summary:        PHP code coverage information
+
+Group:          Development/Libraries
+License:        BSD
+URL:            http://pear.phpunit.de/
+Source0:        http://pear.phpunit.de/get/%{pear_name}-%{version}.tgz
+Source1:        http://github.com/sebastianbergmann/php-code-coverage/raw/master/README.markdown
+
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildArch:      noarch
+BuildRequires:  php-pear >= 1:1.4.9-1.2
+BuildRequires:  php-channel(%{channel})
+
+Requires(post): %{__pear}
+Requires(postun): %{__pear}
+Requires:       php-xml >= 5.2.7
+Requires:       php-pecl(Xdebug) >= 2.0.5
+Requires:       php-pear(%{channel}/File_Iterator) >= 1.2.2
+Requires:       php-pear(%{channel}/PHP_TokenStream) >= 1.0.0
+Requires:       php-pear(%{channel}/Text_Template) >= 1.0.0
+Requires:       php-pear(components.ez.no/ConsoleTools) >= 1.6
+
+Provides:       php-pear(%{channel}/%{pear_name}) = %{version}
+
+%description
+Library that provides collection, processing, and rendering functionality
+for PHP code coverage information.
+
+
+%prep
+%setup -q -c
+# Create a "localized" php.ini to avoid build warning
+cp /etc/php.ini .
+echo "date.timezone=UTC" >>php.ini
+
+cp %{SOURCE1} README.markdown
+
+cd %{pear_name}-%{version}
+# package.xml is V2
+mv ../package.xml %{name}.xml
+
+
+%build
+cd %{pear_name}-%{version}
+# Empty build section, most likely nothing required.
+
+
+%install
+cd %{pear_name}-%{version}
+rm -rf $RPM_BUILD_ROOT docdir
+PHPRC=../php.ini %{__pear} install --nodeps --packagingroot $RPM_BUILD_ROOT %{name}.xml
+
+# Clean up unnecessary files
+rm -rf $RPM_BUILD_ROOT%{pear_phpdir}/.??*
+
+# Install XML package description
+mkdir -p $RPM_BUILD_ROOT%{pear_xmldir}
+install -pm 644 %{name}.xml $RPM_BUILD_ROOT%{pear_xmldir}
+
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+
+%post
+%{__pear} install --nodeps --soft --force --register-only \
+    %{pear_xmldir}/%{name}.xml >/dev/null || :
+
+%postun
+if [ $1 -eq 0 ] ; then
+    %{__pear} uninstall --nodeps --ignore-errors --register-only \
+        %{channel}/%{pear_name} >/dev/null || :
+fi
+
+
+%files
+%defattr(-,root,root,-)
+%doc README.markdown
+%{pear_xmldir}/%{name}.xml
+%{pear_phpdir}/PHP
+%{_bindir}/phpcov
+
+
+%changelog
+* Sun Sep 26 2010 Remi Collet <Fedora at famillecollet.com> - 1.0.0-1
+- initial generated spec + clean
+
diff --git a/sources b/sources
index e69de29..de743df 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+6977ce19dcc469f95c227bf5ea08a8e7  PHP_CodeCoverage-1.0.0.tgz


More information about the scm-commits mailing list