add boundary check
unfold cookie tests and fix variable type inconsitency
rm phpunit.phpt
simplify