When I first tested the Do Not Disturb function, I discovered two ways it could seem like it was not working. One, as mentioned above, was that my screen was not locked. The other was the settings under Settings/Notifications/Do Not Disturb. If your settings allow calls from favorites and then you try to test the feature from a phone in your favorites list, it will not block the call. Similarly, if you are testing multiple times and the allow repeated call option is set, the call will also get through.
And one other observation. All of the material I have seen describes the action of the Do Not Disturb function as silencing the notifications. For incoming calls it does more than that; it actually rejects the call so the caller goes straight to voicemail rather than just ringing silently.