Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arch testing expectation parameters for not->toBeUsedIn() #1260

Open
adamthehutt opened this issue Sep 16, 2024 · 1 comment
Open

Arch testing expectation parameters for not->toBeUsedIn() #1260

adamthehutt opened this issue Sep 16, 2024 · 1 comment

Comments

@adamthehutt
Copy link

The documentation on architecture testing doesn't provide a lot of information on what is supported when using "toBeUsedIn".

I'm trying to test that no model observers are registered within a certain namespace. Some of the things I've tried that don't work:

arch('observers')
->expect('observe')
->not->toBeUsedIn('The\Namespace');

arch('observers')
->expect([Model::class, 'observe'])
->not->toBeUsedIn('The\Namespace');

arch('observers')
->expect(Model::class . '@observe')
->not->toBeUsedIn('The\Namespace');

None of these work. Is this kind of test possible? If so, what syntax should I be using? Thank you!

@danielh-official
Copy link

According to the docs, this should work: https://pestphp.com/docs/arch-testing#content-tobeusedin

If it's not working, then this is a bug.

Question, though. Where did it tell you to use arch('observers') and ->expect('observe')?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants