# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem              1.0
PortGroup               php 1.1

name                    php-unit
set real_name           phpunit
set cap_name            PHPUnit
version                 3.7.22
categories-append       devel
maintainers             nomaintainer
supported_archs         noarch
license                 BSD

homepage                https://github.com/sebastianbergmann/phpunit
master_sites            http://pear.phpunit.de/get/
distname                ${cap_name}-${version}
extract.suffix          .tgz
platforms               darwin freebsd

checksums               rmd160  3ff9547dfa6cb2f473790d062c96f0ca2302cdc1 \
                        sha256  0c7499926910400893d0f1d591fd397ce327bbe2090106bb4cca911c1a51da27

description             unit testing for PHP
long_description \
    PHPUnit  is a member of the  xUnit family of testing frameworks \
    and provides both a framework that makes the writing of tests easy \
    as well as the functionality to easily run the tests and analyse \
    their results.

php.branches            5.3 5.4 5.5

php.build_dirs

if {$name ne $subport} {
    depends_lib         port:${php}-file-iterator \
                        port:${php}-code-coverage port:${php}-timer \
                        port:${php}-unit-mock-objects

    destroot {
        reinplace "s|@php_bin@|${prefix}/bin/php|" ${worksrcpath}/${real_name}.php
        reinplace "s|@php_dir@|${prefix}/lib/php|" ${worksrcpath}/${real_name}.php
        reinplace "s|@php_bin@|${prefix}/bin/php|" ${worksrcpath}/${cap_name}/Util/PHP.php

        reinplace "s|#!/usr/bin/env php|#!${prefix}/bin/php|" ${worksrcpath}/${real_name}.php
        xinstall -m 755 ${worksrcpath}/${real_name}.php ${destroot}${prefix}/bin/${real_name}

        xinstall -d ${destroot}${prefix}/lib/php
        file copy ${worksrcpath}/${cap_name} ${destroot}${prefix}/lib/php/${cap_name}

        set docdir ${destroot}${prefix}/share/doc/${name}
        xinstall -d ${docdir}
        xinstall -m 644 -W ${worksrcpath} README.md ${docdir}
    }

    livecheck.type      none
} else {
    livecheck.type      regex
    livecheck.url       ${homepage}/tags
    livecheck.regex     archive/(\[0-9.\]+)\\.tar
}