开发者

Maven for PHP + PHPUnit version newer than 3.3.9 not working

I want to use Maven for PHP with PHPUnit but when I run my tests with "mvn test" I get this error: http://pastie.org/948377

-------------------------------------------------------
T E S T S
-------------------------------------------------------
[DEBUG] --- Start compiling source folder: C:\unifiedpost\dev\testt\src\test\php
[DEBUG] percentage: 0
querytest.php
[DEBUG] Try to execute command (PHP5): php -d include_path=";C:\unifiedpost\dev\testt/src/main/php;C:\unifiedpost\dev\testt//src/test/php;C:\unifiedpost\dev\testt/target/phpinc;C:\
unifiedpost\dev\testt\src\test\php\cron\common\test;C:\unifiedpost\dev\testt/target/test-classes;C:\unifiedpost\dev\testt/target/classes;" "C:\unifiedpost\dev\testt/target/phpinc/P
HPUnit/TextUI/Maven.php" "C:\unifiedpost\dev\testt\src\test\php\cron\common\test\querytest.php" "C:\unifiedpost\dev\testt\target\surefire-reports/querytest.xml"
[INFO] php.out: PHPUnit 3.4.0 by Sebastian Bergmann.
[INFO] php.out:
[INFO] php.out: ..
[INFO] php.out:
[INFO] php.out: Time: 0 seconds
[INFO] php.out:
[INFO] php.out: OK (2 tests, 2 assertions)
[ERROR] Testcase: querytest.php fails.
[ERROR] See log: C:\unifiedpost\dev\testt\target\surefire-reports/querytest.txt
[ERROR] Testcase: querytest.php fails.
[ERROR] See log: C:\unifiedpost\dev\testt\target\surefire-reports/querytest.txt
[DEBUG]
org.apache.maven.plugin.MojoExecutionException:
PHPUnit 3.4.0 by Sebastian Bergmann...Time: 0 secondsOK (2 tests, 2 assertions) in
File:
 C:\unifiedpost\dev\testt\src\test\php\cron\common\test\querytest.php
Command:
 php -d include_path=";C:\unifiedpost\dev\testt/src/main/php;C:\unifiedpost\dev\testt//src/test/php;C:\unifiedpost\dev\testt/target/phpinc;C:\unifiedpost\dev\testt\src\test\php\cro
n\common\test;C:\unifiedpost\dev\testt/target/test-classes;C:\unifiedpost\dev\testt/target/classes;" "C:\unifiedpost\dev\testt/target/phpinc/PHPUnit/TextUI/Maven.php" "C:\unifiedpo
st\dev\testt\src\test\php\cron\common\test\querytest.php" "C:\unifiedpost\dev\testt\target\surefire-reports/querytest.xml"+

        at org.phpmaven.plugin.build.PhpUnitCompile.executePhpFile(PhpUnitCompile.java:251)
        at org.phpmaven.plugin.build.AbstractPhpCompile.directoryWalkStep(AbstractPhpCompile.java:320)
        at org.codehaus.plexus.util.DirectoryWalker.fireStep(DirectoryWalker.java:174)
        at org.codehaus.plexus.util.DirectoryWalker.scanDir(DirectoryWalker.java:392)
        at org.codehaus.plexus.util.DirectoryWalker.scanDir(DirectoryWalker.java:386)
        at org.codehaus.plexus.util.DirectoryWalker.scanDir(DirectoryWalker.java:386)
        at org.codehaus.plexus.util.DirectoryWalker.scanDir(DirectoryWalker.java:386)
        at org.codehaus.plexus.util.DirectoryWalker.scan(DirectoryWalker.java:345)
        at org.phpmaven.plugin.build.AbstractPhpCompile.goRecursiveAndCall(AbstractPhpCompile.java:348)
        at org.phpmaven.plugin.build.PhpUnitCompile.execute(PhpUnitCompile.java:96)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.phpmaven.plugin.build.PhpCompileException:
PHPUnit 3.4.0 by Sebastian Bergmann...Time: 0 secondsOK (2 tests, 2 assertions) in
File:
 C:\unifiedpost\dev\testt\src\test\php\cron\common\test\querytest.php
Command:
 php -d include_path=";C:\unifiedpost\dev\testt/src/main/php;C:\unifiedpost\dev\testt//src/test/php;C:\unifiedpost\dev\testt/target/phpinc;C:\unifiedpost\dev\testt\src\test\php\cro
n\common\test;C:\unifiedpost\dev\testt/target/test-classes;C:\unifiedpost\dev\testt/target/classes;" "C:\unifiedpost\dev\testt/target/phpinc/PHPUnit/TextUI/Maven.php" "C:\unifiedpo
st\dev\testt\src\test\php\cron\common\test\querytest.php" "C:\unifiedpost\dev\testt\target\surefire-reports/querytest.xml"+

        at org.phpmaven.plugin.build.PhpUnitCompile.executePhpFile(PhpUnitCompile.java:241)
        ... 28 more
[DEBUG] --- Compiling has finished.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO]
PHPUnit 3.4.0 by Sebastian Bergmann...Time: 0 secondsOK (2 tests, 2 assertions) in
File:
 C:\unifiedpost\dev\testt\src\test\php\cron\common\test\querytest.php
Command:
 php -d include_path=";C:\unifiedpost\dev\testt/src/main/php;C:\unifiedpost\dev\testt//src/test/php;C:\unifiedpost\dev\testt/target/phpinc;C:\unifiedpost\dev\testt\src\test\php\cro
n\common\test;C:\unifiedpost\dev\testt/target/test-classes;C:\unifiedpost\dev\testt/target/classes;" "C:\unifiedpost\dev\testt/target/phpinc/PHPUnit/TextUI/Maven.php" "C:\unifiedpo
st\dev\testt\src\test\php\cron\common\test\querytest.php" "C:\unifiedpost\dev\testt\target\surefire-reports/querytest.xml"+



[INFO] ------------------------------------------------------------------------
[DEBUG] Trace
org.apache.maven.lifecycle.LifecycleExecutionException:
PHPUnit 3.4.0 by Sebastian Bergmann...Time: 0 secondsOK (2 tests, 2 assertions) in
File:
 C:\unifiedpost\dev\testt\src\test\php\cron\common\test\querytest.php
Command:
 php -d include_path=";C:\unifiedpost\dev\testt/src/main/php;C:\unifiedpost\dev\testt//src/test/php;C:\unifiedpost\dev\testt/target/phpinc;C:\unifiedpost\dev\testt\src\test\php\cro
n\common\test;C:\unifiedpost\dev\testt/target/test-classes;C:\unifiedpost\dev\testt/target/classes;" "C:\unifiedpost\dev\testt/target/phpinc/PHPUnit/TextUI/Maven.php" "C:\unifiedpo
st\dev\testt\src\test\php\cron\common\test\querytest.php" "C:\unifiedpost\dev\testt\target\surefire-reports/querytest.xml"+


        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImp开发者_如何学编程l.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException:
PHPUnit 3.4.0 by Sebastian Bergmann...Time: 0 secondsOK (2 tests, 2 assertions) in
File:
 C:\unifiedpost\dev\testt\src\test\php\cron\common\test\querytest.php
Command:
 php -d include_path=";C:\unifiedpost\dev\testt/src/main/php;C:\unifiedpost\dev\testt//src/test/php;C:\unifiedpost\dev\testt/target/phpinc;C:\unifiedpost\dev\testt\src\test\php\cro
n\common\test;C:\unifiedpost\dev\testt/target/test-classes;C:\unifiedpost\dev\testt/target/classes;" "C:\unifiedpost\dev\testt/target/phpinc/PHPUnit/TextUI/Maven.php" "C:\unifiedpo
st\dev\testt\src\test\php\cron\common\test\querytest.php" "C:\unifiedpost\dev\testt\target\surefire-reports/querytest.xml"+


        at org.phpmaven.plugin.build.PhpUnitCompile.execute(PhpUnitCompile.java:116)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        ... 17 more
Caused by: org.phpmaven.plugin.build.MuilplePhpCompileException:
PHPUnit 3.4.0 by Sebastian Bergmann...Time: 0 secondsOK (2 tests, 2 assertions) in
File:
 C:\unifiedpost\dev\testt\src\test\php\cron\common\test\querytest.php
Command:
 php -d include_path=";C:\unifiedpost\dev\testt/src/main/php;C:\unifiedpost\dev\testt//src/test/php;C:\unifiedpost\dev\testt/target/phpinc;C:\unifiedpost\dev\testt\src\test\php\cro
n\common\test;C:\unifiedpost\dev\testt/target/test-classes;C:\unifiedpost\dev\testt/target/classes;" "C:\unifiedpost\dev\testt/target/phpinc/PHPUnit/TextUI/Maven.php" "C:\unifiedpo
st\dev\testt\src\test\php\cron\common\test\querytest.php" "C:\unifiedpost\dev\testt\target\surefire-reports/querytest.xml"+


        at org.phpmaven.plugin.build.AbstractPhpCompile.goRecursiveAndCall(AbstractPhpCompile.java:350)
        at org.phpmaven.plugin.build.PhpUnitCompile.execute(PhpUnitCompile.java:96)
        ... 19 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15 seconds
[INFO] Finished at: Thu May 06 16:25:10 EEST 2010
[INFO] Final Memory: 12M/22M
[INFO] ------------------------------------------------------------------------

This happens only when I use a version newer than 3.3.9 for PHPUnit. The tests work just fine with PHPUnit 3.3.9.


I found the problem, it is in Maven.php file from the maven for php plugin.

On line 26 you have:

$arguments['xmlLogfile']=$targetFile;

For PHPUnit versions newer than 3.3.9 you should have

$arguments['junitLogfile']=$targetFile;

The name of 'xmlLogFile' argument changed to 'junitLogFile' from version 3.4.0 on.

I hope the maven for php guys will make the correction asap. Until then you have to checkout the plugin source from here: http://svn.key-tec.de/php-maven/tags/multimaster-1_0/org.phpmaven.multimaster/org.phpmaven.plugin

Modify the Maven.php file as described above and run a "mvn install" from the /src dir - this will install the modified maven for php plugin locally and you will be able to work with it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜