Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
twoseascharlie opened this issue Jan 6, 2022 · 1 comment
Milestone

Comments

@twoseascharlie
Copy link
Contributor

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.

@mrook mrook added this to the 3.0.0-RC4 milestone Jan 17, 2022
@mrook mrook closed this as completed in d9dad85 Jan 17, 2022
@twoseascharlie
Copy link
Contributor Author

Thanks for pushing the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants