orchestral/testbench

PHP Fatal error: Uncaught Error: Class 'Orchestra\Testbench\TestCase' not found

doox911-opensource opened this issue · 0 comments

  • Testbench Version: ^6.17
  • Laravel Version: use in package
  • PHP Version: 7.4
  • Database Driver & Version: not use

Description:

I am trying to test the Laravel package. I need to use facades in the package.I read is better to use the orchestra/testbench package. But when I run the test, I get an error:

PHP Fatal error: Uncaught Error: Class 'Orchestra\Testbench\TestCase' not found

Launched in PhpStorm and from CLI without any results. The package is there and PhpStorm goes to the Orchestra\Testbench\TestCase.

My composer.json:

{
  "name": "this-package/menu",
  "description": "Backend menu",
  "type": "project",
  "license": "proprietary",
  "version": "1.0.1",
  "minimum-stability": "stable",
  "autoload": {
    "psr-4": {
      "ThisPackage\\Menu\\": "src/"
    }
  },
  "autoload-dev": {
    "psr-4": {
      "ThisPackage\\Menu\\Tests\\": "tests/"
    }
  },
  "require": {
    "php": "^7.4|^8.0",
    "second-package/laravel-assert": "^1.0"
  },
  "extra": {
    "laravel": {
      "providers": [
        "ThisPackage\\Menu\\Providers\\MenuServiceProvider"
      ],
      "aliases": {
        "MenuService": "ThisPackage\\Menu\\Facades\\MenuService"
      }
    }
  },
  "require-dev": {
    "phpunit/phpunit": "^9.5",
    "orchestra/testbench": "^6.17"
  },
  "scripts": {
    "test": "phpunit"
  },
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/second-package/laravel-assert.git"
    }
  ]
}

My phpunit.xml:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
  backupStaticAttributes="false"
  bootstrap="bootstrap/autoload.php"
  colors="true"
  convertErrorsToExceptions="true"
  convertNoticesToExceptions="true"
  convertWarningsToExceptions="true"
  processIsolation="false"
  stopOnFailure="false"
>
  <testsuites>
    <testsuite name="Tests">
      <directory suffix="Test.php">./tests</directory>
    </testsuite>
  </testsuites>
  <coverage processUncoveredFiles="true">
    <include>
      <directory suffix=".php">./app</directory>
    </include>
  </coverage>
</phpunit>

Steps To Reproduce: