I think it could be helpful to have a way to query the server to determine if the player is currently on a live realm or a ptr/beta realm.
Currently, the only method that I know is to use LibRealmInfo, a library that contains a full list of live realms from Classic and Retail, so if the player is from a realm not on that list that means he is on a ptr/beta, but this approach required to keep the list up to date.
It will work just with a new Lua function, for example, GetDevelopmentInfo, that returns “ptr” on a ptr realm, “beta” on a beta realm, and nil on non-development realms. The different versions of beta and ptr (classic/retail) could be differentiated by checking if the client is classic or retail which is already possible.
If I am wrong and there is already a way on Lua to determine that a player is on beta/ptr please let me know how to do it.
EDIT: I have already been informed on Github how to determine if a player is on a test environment, this topic could be closed. The solution is to use C_CVar.GetCVar(“portal”) == “test”