This law is stupid, and it amounts to nothing more than bad policy in an effort to please a constituency that has not thought the issue through.
Florida has had this law in place since 2011 -- however enforcement has been halted by court order as I understand it. During they time they ran the program, they had 2.6% of applicants test positive for drugs (lower than the state's drug rate among the general population), and it ended up costing the state money to implement the program.
Don't get me wrong, I am all for getting drug users off welfare, but the law doesn't do much to actually achieve that either for those that actually tested positive. For example, even if they test positive, they continue to get benefits as long as they undergo a drug rehabilitation program (paid for by the taxpayers of course). If they refuse to do this, but have kids, they can still get benefits for the children (and I am sure will use them solely on the kids).
So, lets get this straight, we have what we perceive to be a broken bureaucratic system, so in an effort to fix it, we create another layer of bureaucracy, and the end result is more spending on these programs. Terrible policy.
And while we are at it in terms of "legal" issues surrounding these laws, it might be noted the first attempt at this came in 2003 when Michigan did it, and it was ruled unconstitutional.