小编Int*_*oot的帖子

如何从命令行运行多个PHPUnit测试套件?

如果您配置了多个测试套件,phpunit.xml如何在命令行中运行多个测试套件而不是所有测试套件?

phpunit.xml

<?xml version="1.0" encoding="utf-8"?>
<phpunit
    backupGlobals="false"
    backupStaticAttributes="false"
    colors="true"
    convertErrorsToExceptions="true"
    convertNoticesToExceptions="true"
    convertWarningsToExceptions="true"
    processIsolation="false"
    stopOnFailure="true"
    syntaxCheck="true"
    bootstrap="tests/bootstrap.php">
        <testsuites>
            <testsuite name="Unit">
                <directory suffix="Test.php">tests/unit</directory>
            </testsuite>
            <testsuite name="Integration">
                <directory suffix="Test.php">tests/integration</directory>
            </testsuite>
            <testsuite name="Acceptance">
                <directory suffix="Test.php">tests/acceptance</directory>
            </testsuite>
        </testsuites>
        <logging>
            <log type="coverage-html" target="build/coverage"/>
            <log type="testdox-html" target="build/requirements.html"/>
        </logging>
        <filter>
            <whitelist>
                <directory suffix=".php">src</directory>
            </whitelist>
        </filter>
</phpunit>
Run Code Online (Sandbox Code Playgroud)

例

phpunit --testsuite Unit|Integration 但不是 Acceptance

phpunit

7
推荐指数
1
解决办法
2895
查看次数

如何使用 nikic/PHP-Parser 解析并列出所有类方法

阅读文档我可以转储收集到的信息,但没有迭代集合以按特定节点类型进行过滤的示例。

use PhpParser\ParserFactory;
use PhpParser\Error;
$parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7);
try {
    $statements = $parser->parse(file_get_contents("SomeClass.php"));
    $methods = array_filter($statements, function($statement) {
        // some form of filtering for methods
    });
} catch (Error $exception) {
    echo "parse error ~> ", $exception->getMessage();
}
Run Code Online (Sandbox Code Playgroud)

php lexer

5
推荐指数
1
解决办法
1996
查看次数

如何使用printf在Bash中缩进字符串?

是否有一个在Bash中缩进字符串的示例(用于输出)?我找到了使用的例子,printf但它们似乎没有按预期工作.我想简单地用给定数量的空格缩进给定的字符串.

echo "Header"
indent "Item 1" 2
indent "Sub Item 1a" 4
indent "Sub Item 1b" 4
Run Code Online (Sandbox Code Playgroud)

会产生输出

Header
  Item 1
    Sub Item 1a
    Sub Item 1b
Run Code Online (Sandbox Code Playgroud)

bash

2
推荐指数
1
解决办法
1563
查看次数

标签 统计

bash ×1

lexer ×1

php ×1

phpunit ×1