4

I have a PHP app that we are adding tests to using 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?

In my composer.json, I have the following:

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

I ran composer update after adding specify and verify and got this output:

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

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. Does this hint towards something wrong with my installation of Codeception?

2
  • 2
    Does the error message say 'Specifiy' or 'Specify' Commented Apr 13, 2015 at 17:34
  • @danronmoon Specifiy - wow, can't tell you how many ppl didn't catch that misspelling. Thank you! Commented Apr 13, 2015 at 17:41

2 Answers 2

1

It is \Codeception\Specify and not \Codeception\Specifiy

Sign up to request clarification or add additional context in comments.

Comments

0

@Deltran having the change dir and type the entire command is indicative that ./vendor/bin is not part of the systems PATH var.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.