wp_get_current_user always returns 0 continued

To use wordpress functions outside the context of the wordpress environment, you can include wp-blog-header.php, so in the context of test.php:

require('./wp-blog-header.php');