0

最近,我认识到该项目opis/closure正面临着serializationphp 已弃用解决方案的问题8.1.1。因此,我创建了一个分支并尝试解决问题,在解决问题时,我尝试使用phpunit. 但我有一些错误如下所示。您能否检查一下并反馈我如何解决这些问题:

标题 描述
操作系统 麦金塔
PHP版本: PHP 8.1.1 (cli) (built: Dec 17 2021 23:49:52) (NTS) 版权所有 (c) The PHP Group Zend Engine v4.1.1, 版权所有 (c) Zend Technologies
PHP单元版本: Sebastian Bergmann 和贡献者的 PHPUnit 9.5.10。
项目 Git 存储库: https://github.com/rhashnull/closure(我的叉子)

错误信息:

PHP Fatal error:  Uncaught Error: Class "Opis\Closure\SerializableClosure" not found in /<private_path>/Projects/closure/tests/ClosureTest.php:447
Stack trace:
#0 phar:///usr/local/Cellar/phpunit/9.5.10/bin/phpunit/phpunit/Util/FileLoader.php(56): include_once()
#1 phar:///usr/local/Cellar/phpunit/9.5.10/bin/phpunit/phpunit/Util/FileLoader.php(43): PHPUnit\Util\FileLoader::load('/Users/arash/Pr...')
#2 phar:///usr/local/Cellar/phpunit/9.5.10/bin/phpunit/phpunit/Framework/TestSuite.php(311): PHPUnit\Util\FileLoader::checkAndLoad('/Users/arash/Pr...')
#3 phar:///usr/local/Cellar/phpunit/9.5.10/bin/phpunit/phpunit/Framework/TestSuite.php(394): PHPUnit\Framework\TestSuite->addTestFile('/Users/arash/Pr...')
#4 phar:///usr/local/Cellar/phpunit/9.5.10/bin/phpunit/phpunit/Runner/BaseTestRunner.php(85): PHPUnit\Framework\TestSuite->addTestFiles(Array)
#5 phar:///usr/local/Cellar/phpunit/9.5.10/bin/phpunit/phpunit/TextUI/Command.php(108): PHPUnit\Runner\BaseTestRunner->getTest('/Users/arash/Pr...', Array)

phpunit.xml

<phpunit bootstrap="./vendor/autoload.php" verbose="true">
    <testsuites>
        <testsuite name="Main">
            <file phpVersion="5.4.0" phpVersionOperator=">=">./tests/ClosureTest.php</file>
        </testsuite>
        <testsuite name="Serialize">
            <file phpVersion="5.4.0" phpVersionOperator=">=">./tests/SerializeTest.php</file>
        </testsuite>
        <testsuite name="Recursive">
            <file phpVersion="7.1.0" phpVersionOperator="&lt;">./tests/RecursiveArrayTest.php</file>
        </testsuite>
        <testsuite name="Signed">
            <file phpVersion="5.4.0" phpVersionOperator=">=">./tests/SignedClosureTest.php</file>
        </testsuite>
        <testsuite name="Namespace">
            <file phpVersion="5.5.0" phpVersionOperator=">=">./tests/NamespaceTest.php</file>
            <file phpVersion="5.5.0" phpVersionOperator=">=">./tests/NamespaceUnqualifiedTest.php</file>
            <file phpVersion="5.5.0" phpVersionOperator=">=">./tests/NamespaceFullyQualifiedTest.php</file>
            <file phpVersion="5.5.0" phpVersionOperator=">=">./tests/NamespacePartiallyQualifiedTest.php</file>
        </testsuite>
        <testsuite name="ReflectionClosure">
            <file phpVersion="5.4.0" phpVersionOperator=">=">./tests/ReflectionClosureTest.php</file>
        </testsuite>
        <testsuite name="ReflectionClosure2">
            <file phpVersion="7.0.0" phpVersionOperator=">=">./tests/ReflectionClosure2Test.php</file>
        </testsuite>
        <testsuite name="ReflectionClosure3">
            <file phpVersion="7.1.0" phpVersionOperator=">=">./tests/ReflectionClosure3Test.php</file>
        </testsuite>
        <testsuite name="ReflectionClosure4">
            <file phpVersion="7.2.0" phpVersionOperator=">=">./tests/ReflectionClosure4Test.php</file>
        </testsuite>
        <testsuite name="ReflectionClosure5">
            <file phpVersion="7.4.0" phpVersionOperator=">=">./tests/ReflectionClosure5Test.php</file>
            <file phpVersion="7.4.0" phpVersionOperator=">=">./tests/NamespaceGroupTest.php</file>
        </testsuite>
        <testsuite name="ReflectionClosure6">
            <file phpVersion="8.0.0-dev" phpVersionOperator=">=">./tests/ReflectionClosure6Test.php</file>
        </testsuite>
    </testsuites>
</phpunit>

作曲家.json

{
    "name": "opis/closure",
    "description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.",
    "keywords": ["closure", "serialization", "function", "serializable", "serialize", "anonymous functions"],
    "homepage": "https://opis.io/closure",
    "license": "MIT",
    "authors": [
        {
            "name": "Marius Sarca",
            "email": "marius.sarca@gmail.com"
        },
        {
            "name": "Sorin Sarca",
            "email": "sarca_sorin@hotmail.com"
        }
    ],
    "require": {
        "php": "^5.4 || ^7.0 || ^8.0"
    },
    "require-dev": {
        "jeremeamia/superclosure": "^2.0",
        "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0"
    },
    "autoload": {
        "psr-4": {
            "Opis\\Closure\\": "src/"
        },
        "files": ["functions.php"]
    },
    "autoload-dev": {
        "psr-4": {
            "Opis\\Closure\\Test\\": "tests/"
        }
    },
    "extra": {
        "branch-alias": {
            "dev-master": "3.6.x-dev"
        }
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true
    }
}

特别感谢您的关注。

4

0 回答 0