- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 phpstorm 并在我的 laravel 应用程序中编写了一些测试。 phpunit.xml
几乎是默认的。
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./app</directory>
</include>
</coverage>
<php>
<server name="APP_ENV" value="testing"/>
<server name="BCRYPT_ROUNDS" value="4"/>
<server name="CACHE_DRIVER" value="array"/>
<server name="DB_CONNECTION" value="sqlite"/>
<server name="DB_DATABASE" value=":memory:"/>
<server name="MAIL_MAILER" value="array"/>
<server name="QUEUE_CONNECTION" value="sync"/>
<server name="SESSION_DRIVER" value="array"/>
<server name="TELESCOPE_ENABLED" value="false"/>
</php>
</phpunit>
在我的任务结束时,我收到以下错误:
Time: 00:15.742, Memory: 58.00 MB
OK (26 tests, 69 assertions)
Generating code coverage report in Clover XML format ... syntax error, unexpected '-', expecting '{'
Process finished with exit code 2
我不知道我应该从哪里开始看。感谢任何帮助!
通过尝试生成 html 报告同样的问题
❯ .\vendor\bin\phpunit --coverage-html ./coverage.html
PHPUnit 9.5.5 by Sebastian Bergmann and contributors.
............................ 28 / 28 (100%)
Time: 00:23.702, Memory: 74.00 MB
OK (28 tests, 125 assertions)
Generating code coverage report in HTML format ... syntax error, unexpected '-', expecting '{'
运行简化的最小重现测试用例:
class MinimalTest extends TestCase
{
/**
* A basic feature test example.
*
* @return void
*/
public function test_example()
{
$response = $this->get('https://google.com');
$response->assertStatus(200);
}
}
❯ .\vendor\bin\phpunit --filter MinimalTest --coverage-html ./coverage.html
❯ .\vendor\bin\phpunit --debug --filter MinimalTest --coverage-html ./coverage.html
PHPUnit 9.5.5 by Sebastian Bergmann and contributors.
Runtime: PHP 7.4.16 with Xdebug 3.0.4
Configuration: C:\Users\***\localGit\xampp\htdocs\oneup\app\phpunit.xml
Test 'Tests\Feature\MinimalTest::test_example' started
Test 'Tests\Feature\MinimalTest::test_example' ended
Time: 00:01.242, Memory: 42.00 MB
OK (1 test, 1 assertion)
Generating code coverage report in HTML format ... syntax error, unexpected '-', expecting '{'
最佳答案
我终于找到问题了。我通过排除 Laravel 的目录来隔离根本原因。错误的目录实际上是 app/View
因为我在生成 laravel
components
时犯了一个早期错误 Laravel 生成 view
和controller
组件的文件。如果不需要 php 逻辑,并不总是需要触摸 Controller ,这就是为什么我没有看到问题。
这些时候我用错误的模式创建了组件,这导致 Laravel 生成损坏的类(我的错,不是 Laravel 的错)。通过清除这些,覆盖率报告成功生成,没有任何排除。
感谢@hakre,我知道我的问题非常普遍,无法重现。
关于laravel - 正在生成 Clover XML 格式的代码覆盖率报告...语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68169837/
我有未发布的生产应用程序,我需要在发布它之前在 clover 的开发设备或 Android 手机中测试“应用程序通知”。我已经在开发环境中进行了测试。有什么办法让我可以在发布之前对其进行测试 提前致谢
我正在使用 Checkstyle 和 PMD 的 Clover 插件 3.1.0。 在检测类的启动时附加以下代码 public static class __CLR3_1_0crcrhnxpu1rh{
我在从 hudson 运行时遇到 java 堆空间错误,我将我的 MAVEN_OPTS 设置如下,任何人都可以让我知道此问题的解决方案是什么。 -Xmx4096m -XX:PermSize=3000m
我目前正在探索在项目中使用的各种代码覆盖工具,并在三叶草,艾玛和cobertura之间的三叶草。 (我的组织已经准备好为三叶草买单了,它很好) 但是我们没有自动化测试。所有测试都是手动的,我们需要使用
我想告诉 Clover 忽略我的 Java 代码的特定行。 有没有办法从代码中做到这一点? 就像是 //// IGNORE vvvvvvv System.out.println("Ignore thi
有什么方法可以隐藏类或方法,使其不包含在 Clover 代码覆盖率报告中吗?我们在同一目录中有一些概念验证代码以及生产质量代码。此概念代码包含在代码覆盖率报告中,这会扭曲我们的数字。我们想知道我们是否
我刚刚将 CloverPHP 设置到我的 Jenkins 工作中。 我正在使用 PHPUnit 生成三叶草报告,它似乎与显示文件的覆盖率报告不同,一切正常 /usr/share/php/Symfony
我使用的是 Clover 2.5,我有一个可以打包二进制文件的目标。但是,目前,似乎 Clover 检测类是在与我希望打包在 jar 中的未检测类相同的输出目录中生成的。 我如何着手创建一个 jar
我正在开发一个定制的应用程序来解析 clover.xml报告。 只是想知道是否有人知道哪个是获得 Classes and Traits 的正确公式总覆盖率。 这是我为 Lines 找到的公式和 Fun
我刚刚使用 Clover 对我的项目进行了代码覆盖率分析,结果约为 60%。我和 Jacoco 对同一个项目进行了分析,结果约为 52%。 8%的差异正常吗?我过去也一直使用这些工具运行代码覆盖率分析
您好,我是一名 Java Web 应用程序开发人员 我有一个问题,我想让 clover 在运行时为我的 Web 应用程序收集数据。 我确实通过向 Tomcat 添加参数(-Dclover.initst
我正在尝试找出一种方法来更改我已定义的参数值,以及如何使用 Clover ETL 中的 REFORMAT 组件动态创建新参数。 我在重新格式化组件提供的转换方法中编写了一些小逻辑: f
我有几个项目不同扩展的 clover.xml 报告。我想将它们组合成一个 clover.xml,然后将其创建成一个三叶草 html。但我看不到 phpunit 类 PHP_CodeCoverage、P
我正在使用 phpstorm 并在我的 laravel 应用程序中编写了一些测试。 phpunit.xml 几乎是默认的。 ./tests/Fe
有人成功地将 gradle-clover-plugin 与 Grails 3 集成吗?我对 build.gradle 最接近的是: clover { additionalSourceDirs
我正在现有项目中设置 Clover。它无法检测一行源代码: if ((character != 'ö') && (character != 'ø') && (character != 'ü') 出现错
我正在尝试运行 maven clover 插件来生成报告以及生成非检测 Artifact 。 com.atlassian.maven.plugins
我使用 Spring JavaConfig 来定义我的 Spring 配置。由于单元测试使用与生产代码不同的 Spring 配置,因此当我将 Clover 代码覆盖率与单元测试一起使用时,生产配置显示
我想使用 Clover 在 SonarQube 上查看我的项目的代码覆盖率结果。我已按照 SonarQube 网站上给出的所有步骤进行操作。我生成了 JUnit 和 Clover 覆盖率报告,并在 s
我正在使用一个简短的 ant 脚本来生成我的 Clover 覆盖率报告。我想从报告中排除某些源文件。代码已经完全检测,在检测过程中排除该文件对我来说是不可行的。 ant 构建 xml 摘录(已修剪):
我是一名优秀的程序员,十分优秀!