You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, I just started throwing some misc classes in my fake/ directory. They are just minimal interface implementations so I didn't care to reflect where they might go in the src/ directory if they were real classes. But adding "Fake\\": "fake/" to composer.json would mean that the specs for these classes would be in spec/, which I felt would be confusing. Solution? PSR-0. Now they get their own directory, spec/Fake. But if you have a psr4_prefix mapping in your phpspec.yml configuration, then phpspec won't be able to find the class, claiming it must be in "the base spec namespace spec\App\".
0d209c8f2ff3:/app# php vendor/bin/phpspec desc Fake/FooSpecification for Fake\Foo created in /app/spec/Fake/FooSpec.php.0d209c8f2ff3:/app# php vendor/bin/phpspec run Fake/Foo 00 specs0 examples0ms0d209c8f2ff3:/app# php vendor/bin/phpspec run spec/Fake/FooSpec.phpIn PSR0Locator.php line 300: Spec class `spec\Fake\FooSpec` must be in the base spec namespace `spec\App\`.run [-f|--format FORMAT] [--stop-on-failure] [--no-code-generation] [--no-rerun] [--fake] [-b|--bootstrap BOOTSTRAP] [--] [<spec>]0d209c8f2ff3:/app#
Although this does sort of make it seem like the concept of a suite is not isolated, this isn't a huge problem. I don't really need to do this, but it would've been nice to have it documented.
The text was updated successfully, but these errors were encountered:
Actually, it would seem if any suite has the psr4_prefix then it seems to only pick one for the root namespace. How this decision is made escapes me.
ash-m
changed the title
Documentation needed: phpspec.yml does not different PSRs in different suites
Documentation needed: phpspec.yml does not support different PSRs in different suites
Feb 15, 2024
So, I just started throwing some misc classes in my
fake/
directory. They are just minimal interface implementations so I didn't care to reflect where they might go in thesrc/
directory if they were real classes. But adding"Fake\\": "fake/"
tocomposer.json
would mean that the specs for these classes would be inspec/
, which I felt would be confusing. Solution? PSR-0. Now they get their own directory,spec/Fake
. But if you have apsr4_prefix
mapping in yourphpspec.yml
configuration, then phpspec won't be able to find the class, claiming it must be in "the base spec namespacespec\App\
".Here' s part of my
composer.json
:Here's my
phpspec.yml
:Here's what I ran:
Although this does sort of make it seem like the concept of a
suite
is not isolated, this isn't a huge problem. I don't really need to do this, but it would've been nice to have it documented.The text was updated successfully, but these errors were encountered: