-w tests to see if the script is capable of writing (to) the file i.e. using the statically defined permissions on the file, not dynamically i.e. run-time determination, as required by the OP.
A user level that continues to overstate my experience :-))