Skip to content

Missing php namespace in phpunit-noframes.xsl for phing-3.0.0-RC3.phar release #1656

Closed
@twoseascharlie

Description

Describe the bug
I'm using the phing-3.0.0-RC3.phar from the releases github page. After running some phpunit tests using the phpunit task and trying to generate a noframes html from the test results xml file, a php error is dumped (see below).

Steps To Reproduce
Create a simple build.xml file to run phpunit tests:

    <target name="test" description="runs phpunit unit tests" depends="set.props.main.test,enforce.build.dirs,genautoload">
        <phpunit bootstrap="${build.dir}/bootstraptests-test.php" printsummary="true" failureproperty="test.fail.check" errorproperty="test.error.check" >
            <formatter type="plain" usefile="false"/>
            <formatter type="xml" todir="testresults" outfile="test.xml"/>
            <batchtest>
                <fileset dir="${build.dir}">
                    <include name="**/*Test.php"/>
                </fileset>
            </batchtest>
        </phpunit>
        <mkdir dir="testresults/test" />
        <phpunitreport infile="testresults/test.xml"
            format="noframes"
            todir="testresults/test"
            />
        <phingcall target="enforce.test.failures" />
    </target>

Expected behavior
PHPUnit test case report is generated from xml file to html no frames file.

Screenshots / terminal output

checkHookPlugin > test:

  [phpunit] Testsuite: DHHDev\CHP\misc\callableTesting\CallableHooksTest
  [phpunit] Tests run: 1, Risky: 0, Warnings: 0, Failures: 0, Errors: 1, Incomplete: 0, Skipped: 0, Time elapsed: 0.05547 s
  [phpunit] testSomething ERROR
  [phpunit] Call to undefined function DHHDev\CHP\misc\callableTesting\add_action()
  [phpunit] Total tests run: 1, Risky: 0, Warnings: 0, Failures: 0, Errors: 1, Incomplete: 0, Skipped: 0, Time elapsed: 0.06520 s
[PHP Error] XSLTProcessor::transformToXml(): xmlXPathCompOpEval: function function bound to undefined prefix php [line 185 of phar:///home/pi/files/utils/php/phing-3.0.0-RC3.phar/vendor/phing/task-phpunit/src/PHPUnitReportTask.php]
[PHP Error] XSLTProcessor::transformToXml(): xmlXPathCompiledEval: 1 objects left on the stack. [line 185 of phar:///home/pi/files/utils/php/phing-3.0.0-RC3.phar/vendor/phing/task-phpunit/src/PHPUnitReportTask.php]
[PHP Error] XSLTProcessor::transformToXml(): runtime error: file phar:///home/pi/files/utils/php/phing-3.0.0-RC3.phar/etc/phpunit-noframes.xsl line 412 element value-of [line 185 of phar:///home/pi/files/utils/php/phing-3.0.0-RC3.phar/vendor/phing/task-phpunit/src/PHPUnitReportTask.php]
[PHP Error] XSLTProcessor::transformToXml(): XPath evaluation returned no result. [line 185 of phar:///home/pi/files/utils/php/phing-3.0.0-RC3.phar/vendor/phing/task-phpunit/src/PHPUnitReportTask.php]

Additional context
After changing this xslt file:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
    xmlns:exsl="http://exslt.org/common"
    xmlns:str="http://exslt.org/strings"
    xmlns:date="http://exslt.org/dates-and-times"
    extension-element-prefixes="exsl str date">

To this (I added xmlns:php="http://php.net/xsl"):

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
    xmlns:exsl="http://exslt.org/common"
    xmlns:str="http://exslt.org/strings"
    xmlns:date="http://exslt.org/dates-and-times"
    xmlns:php="http://php.net/xsl"
    extension-element-prefixes="exsl str date">

It will now successfully generate the html reports.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions