There are helper functions for this. See test_framework/phpbb_test_case_helpers.php
copy_dir for this, remove_files for teardown