简体   繁体   English

未找到 Codeception 特征“Codeception\\Specify”

[英]Codeception trait 'Codeception\Specifiy' not found

I have a PHP app that we are adding tests to using Codeception.我有一个 PHP 应用程序,我们正在添加测试以使用 Codeception。 We tried to add Specify (and Verify) to our suite but it isn't being recognized.我们尝试将指定(和验证)添加到我们的套件,但它没有被识别。 how do you correctly set up Specify for use with Codeception?您如何正确设置指定与 Codeception 一起使用?

In my composer.json, I have the following:在我的 composer.json 中,我有以下内容:

{
  "require-dev": {
    "codeception/codeception": "2.0.11",
    "codeception/specify": "*",
    "codeception/verify": "*"
  }
}

I ran composer update after adding specify and verify and got this output:我在添加指定和验证后运行了 composer update 并得到了这个输出:

Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing myclabs/deep-copy (1.3.0)
    Downloading: 100%

  - Installing codeception/specify (0.4.1)
    Downloading: 100%

  - Installing codeception/verify (0.2.7)
    Downloading: 100%

Writing lock file
Generating autoload files

I have a test like this (mostly what was made from generate:test) :我有一个这样的测试(主要是由生成:测试):

<?php

class ServiceTest extends \Codeception\TestCase\Test
{

    use \Codeception\Specifiy;
    /**
     * @var \UnitTester
     */
    protected $tester;

    protected function _before()
    {
    }

    protected function _after()
    {
    }

    // tests
    public function testCall() {
      $this->specify("An instance of the service is invoked");
    }

}

When I run my unit tests, I get the output:当我运行单元测试时,我得到输出:

Fatal error: Trait 'Codeception\Specifiy' not found in /Users/person/neat_app/tests/unit/ServiceTest.php on line 6

The references I'm using are: http://codeception.com/10-04-2013/specification-phpunit.html and https://github.com/Codeception/Specify我使用的参考是: http ://codeception.com/10-04-2013/specification-phpunit.html 和https://github.com/Codeception/Specify

What am I missing to have have Specify visible to my test runner?我缺少什么让我的测试运行者可以看到指定?

EDIT: I have to invoke my tests like this - ./vendor/bin/codecept run unit Not just by typing codecept at the application directory.编辑:我必须像这样调用我的测试 - ./vendor/bin/codecept run unit不仅仅是通过在应用程序目录中键入 codecept 。 Does this hint towards something wrong with my installation of Codeception?这是否暗示我的 Codeception 安装有问题?

它是\\Codeception\\Specify而不是\\Codeception\\Specifiy

具有更改目录并输入整个命令的@Deltran表示./vendor/bin不是系统PATH var的一部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM