0
votes

I just installed Eclipse Oxygen Then I installed PHP 7.0.22

In Eclipse I create a PHP project "phput" Then following the guide found in https://phpunit.de/getting-started-with-phpunit.html

In the project folder

$ composer.phar require --dev phpunit/phpunit ^6

Everything seems OK

$ cat composer.json 
{
"require-dev": {
"phpunit/phpunit": "^6"
}

} $ ./vendor/bin/phpunit --version PHPUnit 6.5.5 by Sebastian Bergmann and contributors.

However, when I look at my project in Eclipse, most of the components in vendor have some sort of errors (71 errors in total)

this is my project

Even the class PHPUnit_Framework_TestCase causes this error ...cannot resolved to a type

What did I do wrong here?

2

2 Answers

0
votes

Exclude the vendor folder from your project source folders by marking it as a library folder,

right-click ยป Use as Library Folder

that way Eclipse will still read it for code completion and to show you documentation but it won't show any errors.

0
votes
  1. Enable composer support for you project: right click on project -> configure -> add composer support
  2. Update project build path: right click on project -> composer -> update build path
  3. Wait a moment

Note: Since PHPUnit 6, PHPUnit_Framework_TestCase become PHPUnit\Framework\TestCase

Note 2 Current stable PDT version (5.2) doesn't work well with PHPUnit 6. This was fixed in PDT 5.3: https://wiki.eclipse.org/PDT/NewIn53 now available via nightly builds, see https://eclipse.org/pdt/ for links.