1

I am following a Lynda.com Tutorial and can't get PHPUnit to work.

Here is what I did:

Project folder: C:\wamp\www\stats

In this folder I have a composer.json file:

{
    "require": {
    },
    "require-dev": {
        "phpunit/phpunit": "*"
    },
    "autoload": {
        "psr-0": {
            "stats": ""
        }
    }
}

I ran the composer command:

>composer update

It created a new folder C:\wamp\www\stats\vendor containing many subfolders, even /Symfony...??

Then I opened cmd.exe and wanted to run phpunit:

>cd C:\wamp\www\stats\
>phpunit

But it doesn't work. Error message: Command "phpunit" not found

Can anyone help?

user838531
  • 478
  • 5
  • 14

1 Answers1

1

As described in documentation:

For a system-wide installation via Composer, you can run:

composer global require "phpunit/phpunit=5.0.*"

I recommend to not use version as of last stable is 5.2

Note that you should use version ^4.8 for php < 5.6

Also you need to add composer folder (C:\Users\<username>\AppData\Roaming\Composer\vendor\bin) to your path enviroment variable

Community
  • 1
  • 1
Nikita U.
  • 3,540
  • 1
  • 28
  • 37