Function not working on any file other than the main plugin file

I guess you should be using register_activation_hook() with the full path including filename, not just the path:

register_activation_hook( plugin_dir_path(__FILE__) . 'test-plugin.php', 'enable_user_registration' );