You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[WOOTAX-294] Make the asset file path overridable for tests
Use the WCSERVICES_PLUGIN_DIST_DIR constant and extract the asset path
into a protected method, so tests can point the lookup at a temp
directory instead of writing fixtures into the real dist directory.
rmdir( Utils::get_plugin_path() . 'dist' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_rmdir --- Test cleanup of a directory the test created.
39
-
$this->created_dist_dir = false;
39
+
if ( is_dir( $this->asset_dir ) ) {
40
+
rmdir( $this->asset_dir ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_rmdir --- Test cleanup of a temp directory the test created.
40
41
}
41
42
42
43
parent::tear_down();
43
44
}
44
45
45
46
/**
46
-
* Build an integration instance like the plugin loader does.
47
+
* Build an integration instance whose asset lookup uses the temp directory.
file_put_contents( // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_file_put_contents --- Test fixture written to a location the test cleans up.
83
-
$this->asset_file,
78
+
file_put_contents( // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_file_put_contents --- Test fixture written to a temp directory the test cleans up.
0 commit comments