dongxiaoguang9108 2018-11-14 20:33
浏览 140

Symfony fzaninotto / faker,错误:未找到“Faker \ Factory”类

I'm working with Symfony, and the library fzaninotto/faker

I'm using this library to test some stuff, but when running phpunit I have this error:

Error: Class 'Faker\Factory' not found

As usual I'm using the right use Faker\Factory;

As you can see is required only in my dev and I installed it running composer install

composer.json

{
"type": "project",
"license": "proprietary",
"require": {
    "php": "^7.1.3",
    ...
    "symfony/framework-bundle": "4.1.*",
},
"require-dev": {
    "fzaninotto/faker": "^1.8",
    "symfony/dotenv": "4.1.*",
    "symfony/test-pack": "^1.0"
},
"config": {
    "preferred-install": {
        "*": "dist"
    },
    "sort-packages": true
},
"autoload": {
    "psr-4": {
        "App\\": "src/"
    }
},
"autoload-dev": {
    "psr-4": {
        "App\\Tests\\": "tests/"
    }
},
"replace": {
    "paragonie/random_compat": "2.*",
    "symfony/polyfill-ctype": "*",
    "symfony/polyfill-iconv": "*",
    "symfony/polyfill-php71": "*",
    "symfony/polyfill-php70": "*",
    "symfony/polyfill-php56": "*"
},
"scripts": {
    "auto-scripts": {
        "cache:clear": "symfony-cmd",
        "assets:install %PUBLIC_DIR%": "symfony-cmd"
    },
    "post-install-cmd": [
        "@auto-scripts"
    ],
    "post-update-cmd": [
        "@auto-scripts"
    ]
},
"conflict": {
    "symfony/symfony": "*"
},
"extra": {
    "symfony": {
        "allow-contrib": false,
        "require": "4.1.*"
    }
}

}

  • 写回答

1条回答 默认 最新

  • doujia9204 2018-11-14 21:43
    关注

    Possibly my solution is not the best, But instead of the recommended pack "Use Symfony's bridge: composer require --dev phpunit"

    I decided to install the usual "composer require --dev phpunit/phpunit ^6.5"

    Then everything worked as expected.

    评论

报告相同问题?

悬赏问题

  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据
  • ¥20 给自己本科IT专业毕业的妹m找个实习工作
  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)