Maven for PHP + PHPUnit版本比3.3.9更新不起作用

时间:2010-05-19 10:39:01

标签: php phpunit maven-for-php

我想在PHPUnit中使用Maven for PHP但是当我使用“mvn test”运行我的测试时出现此错误: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(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.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] ------------------------------------------------------------------------

只有当我使用比3.3.9更新的PHPUnit版本时才会发生这种情况。使用PHPUnit 3.3.9,测试工作正常。

1 个答案:

答案 0 :(得分:2)

我发现了这个问题,它来自Maven for php插件的Maven.php文件。

在第26行,你有:

$参数[ '的 xmlLogfile '] = $的TargetFile;

对于比3.3.9更新的PHPUnit版本,你应该有

$参数[ '的 junitLogfile '] = $的TargetFile;

'xmlLogFile'参数的名称从版本3.4.0开始更改为'junitLogFile'。

我希望php家伙的maven会尽快进行修正。 在此之前,您必须从此处查看插件源:http://svn.key-tec.de/php-maven/tags/multimaster-1_0/org.phpmaven.multimaster/org.phpmaven.plugin

如上所述修改Maven.php文件并从/ src dir运行“mvn install” - 这将在本地安装修改后的maven for php插件,您将可以使用它。