Open rela589n opened 4 months ago
To achieve this we would need to add the ability to combine assertions (#242) and a new assertion shouldBeInNamespace
, being the first one the most challenging feature.
I wonder why couldn't we allow shouldBeNamed
to work with full classname (including namespace) rather than class basename?
Currently shouldBeNamed applied to Foo\Bar class checks only Bar part (rather than Foo\Bar).
From my side, while I was trying to make it work, it has taken me quite a while until I understood that shouldBeNamed works only with the last part of the namespace.
Please, let me know your thoughts on this regard
TBH I have no hard feelings on this, but the classname selector works with FQCN so this could be an opportunity to standarize selector and assertion. There is a PR open but since this is a breaking change, it will need to be released with v0.11 (which I plan to finish by the end of the month)
Enhancement description
It would really make sense to have the ability to enforce not only the actual class naming like this:
But to apply rules for namespace:
In this example, phpat would check if api tests are placed in Tests\Api directory and named with ApiTest suffix.