-2

Apologies upfront if this question has been asked somewhere else or here even (search results did not give me what I was looking for). I would like to configure my core file to live in my own namespace meanwhile, say, application namespace seats somewhere.

Below is how the file structure is intended to be laid down.

app/Rentals
src/Core

Effectively, with the directory structure in mind I can have the following psr-4 autoloading entry in composer.json file.

{
   ...,
     "psr-4": {
        "Rentals\\": "app/",
        "Selocrast\\": "src/"
    }
}

Lastly I am going to show you my current phpspec.yaml file and the configuration it contains right now.

suites:
  selocrast_suite:
    namespace: Selocrat

  rawson_suite:
    namespace: Rentals
    src_path: "%paths.config%/app"

  extensions:
    LeanPHP\PhpSpec\CodeCoverage\CodeCoverageExtension: ~

As it maybe seen on the configuration file above I did a few tweaks to get at least one namespace to work(the default). What I am struggling with is having multiple suites pointing to different namespace directories.

The type Rental\Component\Model\Entity\Simple was generated but could not be loaded. Do you need to configure an au toloader?

I am finding it difficult to move on with this setup is it something that PHPSpec is enforcing at code level? If not, what could I be doing wrong then?

Below is the version I am in:

$ bin/phpspec --version
phpspec 4.3.2

Is it a matter of creating an extension to manage my secondary namespace?

scruffycoder86
  • 527
  • 1
  • 5
  • 24

1 Answers1

0

I think you should modify config file as follows

suites:
  selocrast_suite:
    namespace: Selocrat
    psr4_prefix: Selocrat

  rawson_suite:
    namespace: Rentals
    psr4_prefix: Rentals
    src_path: "%paths.config%/app"

  [...]
DonCallisto
  • 29,419
  • 9
  • 72
  • 100
  • Thanks, I will try this out and revert back to this answer with an acceptance if it so happens to solve my issue. I find using two separate configuration files daunting to always have to specify them with every PHPSpec run/describe command. Thanks – scruffycoder86 Mar 08 '19 at 12:41
  • What I ended up doing is I created separate configuration files and just run my PHPSpec commands separately by specifying the config I want. I don't really like this approach but it worked for what I needed to do – scruffycoder86 Mar 22 '19 at 09:39