0

I am trying to setup phpspec in a Laravel project.

I have installed phpspec properly and am running phpspec inside my project without any trouble.

My composer.json file has the following relevant lines:

"autoload": {
    "classmap": [
        "database"
    ],
    "psr-4": {
        "Acme\\": "app/Acme"
    }
},

My phpspec.yml:

suites:
  app_suite:
    namespace: Acme
    src_path: app
    spec_path: app
    spec_prefix: spec

Executing phpspec describe Acme/Foo created app\spec\Acme\FooSpec.php file. Executing phpspec run created app\Acme\Foo.php

But I am getting the following error when I run "phpspec run" -

The type Acme\Foo was generated but could not be loaded. Do you need to configure an autoloader?

Everything is fine, except for the auto-loading error. How can I solve the issue?

Placid
  • 1,400
  • 3
  • 22
  • 33

1 Answers1

2

try

composer dump-autoload

It just regenerates the list of all classes that need to be included, when you have a new class inside your project

vitr
  • 6,766
  • 8
  • 30
  • 50
  • The default locations used by phpspec for the spec files and source files are `spec` and `src` respectively. If you don't have the namespace parameter in the phpspec.yml then place your files in the default location. – vitr Jun 17 '16 at 09:39