Testing relation managers
I have followed the info at https://filamentphp.com/docs/3.x/panels/resources/relation-managers#conditionally-showing-relation-managers to conditionally show a relation manager. However, I am facing a problem where testing always passes even when the relation manager is not rendered.
As an extreme example, consider this code on the relation manager:
But this test passes:
In fact, to be even more extreme, I went into the
CategoryResource
class and removed the getRelations()
function entirely so now I definitely don't have any relation manager displaying but that test is still passing. The only way I can get the test to fail is by deleting the PostsRelationManager
entirely.1 Reply
Anyone have any idea about this? It seems like I'm inadvertently testing whether the relationmanager works, when what I am really trying to do is test to see whether it's being displayed on a given page.
This is because I have logic to hide the relation manager when the record has a certain status. So I want to test for that.