【问题标题】:PHPStorm - Process finished with exit code 255PHPStorm - 进程以退出代码 255 完成
【发布时间】:2016-04-04 20:11:07
【问题描述】:

我正在尝试在 Symfony 3 框架中进行单元测试。这是我的配置;

这是我面临的错误。

/Applications/MAMP/bin/php/php7.0.0/bin/php /private/var/folders/w9/cmwlplqx53x3slxkm4c1chx00000gn/T/ide-phpunit.php --bootstrap /Users/muhammetergenc/code/kampweb/phpunit.xml.dist --configuration /Users/muhammetergenc/code/kampweb/phpunit.xml.dist Tests\AppBundle\Controller\PersonTest /Users/muhammetergenc/code/kampweb/tests/AppBundle/Controller/PersonTest.php
Testing started at 3:04 PM ...
<?xml version="1.0" encoding="UTF-8"?>

<!-- http://phpunit.de/manual/4.1/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
         backupGlobals="false"
         colors="true"
         bootstrap="app/autoload.php">

    <!-- <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
             backupGlobals="false"
             colors="true"
             bootstrap="web/app_test.php">-->
    <php>
        <ini name="error_reporting" value="-1" />
        <server name="KERNEL_DIR" value="app/" />
    </php>

    <testsuites>
        <testsuite name="Project Test Suite">
            <directory>tests</directory>
        </testsuite>
    </testsuites>

    <filter>
        <whitelist>
            <directory>src</directory>
            <exclude>
                <directory>src/*Bundle/Resources</directory>
                <directory>src/*/*Bundle/Resources</directory>
                <directory>src/*/Bundle/*Bundle/Resources</directory>
            </exclude>
        </whitelist>
    </filter>
</phpunit>

Process finished with exit code 255

我在我的其他桌面上确实有相同的配置,它工作得很好。

【问题讨论】:

  • 您已将其设置为使用 XML 文件作为引导文件,然后尝试将 XML 作为 PHP 运行并失败。
  • @JimL 如果不是扩展 PHPUnit 框架的 PHP 类,它不会被忽略吗?
  • 我取消选中默认引导文件选项,但仍然收到相同的错误。 @JimL

标签: php unit-testing symfony


【解决方案1】:

今天我遇到了同样的错误 - 255。 就我而言,我没有在 setUp 方法中声明 CONSTANTS。

我认为你有类似的东西。 尝试使用 xdebug 找到它 - 它帮助了我。

【讨论】:

    【解决方案2】:

    就我而言,这是一个内存问题。

    setUp() 方法中,我初始化了多个类属性。

    我的解决方法是定义(覆盖)tearDown() 方法以在每次测试后取消设置属性。

    protected function tearDown(): void
    {
        // clean memory
        unset($this->foo);
        unset($this->bar);
    
        parent::tearDown();
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-07-20
      • 1970-01-01
      • 2020-01-31
      • 1970-01-01
      • 2018-11-10
      • 2018-09-01
      • 2020-06-13
      相关资源
      最近更新 更多