【问题标题】:php unit testing problem in phpunit.xml filephpunit.xml 文件中的 php 单元测试问题
【发布时间】:2022-01-01 15:07:33
【问题描述】:

使用 php 单元测试和我的 phpunit.xml 文件是这样的

<?xml version="1.0"  encording="UTF-8" ?>

<phpunit bootstrap="vendor/autoload.php">

    <testsuits>
    
         <testsuit name="unit">
         
             <directory>tests</directory>
         
         </testsuit>
    
    </testsuits>

</phpunit>

但是当我执行以下运行命令 vendor/bin/phpunit 编译器得到以下错误消息 Could not load "C:\Users\Orukawa\Desktop\phpunittest\phpunit.xml". parsing XML declaration: '?&gt;' expected

我该如何解决这个问题?

【问题讨论】:

  • 您的声明有错字。 encording 而不是 encoding
  • @rpm192 是的,现在工作正常

标签: php xml phpunit


【解决方案1】:

phpunit.xml 中有错字。正确的配置是:

<?xml version="1.0"  encoding="UTF-8" ?>

<phpunit bootstrap="vendor/autoload.php">

    <testsuits>
    
         <testsuit name="unit">
         
             <directory>tests</directory>
         
         </testsuit>
    
    </testsuits>

</phpunit>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-12-01
    • 2011-05-01
    • 2012-07-09
    • 2011-10-28
    • 1970-01-01
    • 1970-01-01
    • 2016-08-23
    相关资源
    最近更新 更多