@@ -51,26 +51,33 @@ public function pluginCli( array $args, array $expect_warnings = [] ): array {
5151 return $ this ->wpCli ( [ 'static-deploy ' , ...$ args ], $ expect_warnings );
5252 }
5353
54+ public function getFileContents (
55+ string $ base_dir ,
56+ string $ path ,
57+ ): string {
58+ $ content = file_get_contents ( "{$ base_dir }/ $ path " );
59+ $ this ->assertNotFalse ( $ content , "Failed to read file: {$ base_dir }/ $ path " );
60+ return $ content ;
61+ }
62+
5463 public function getCrawledFileContents ( string $ path ): string
5564 {
56- $ wordpress_dir = ITEnv:: getWordPressDir ();
57- $ crawled_site_dir = $ wordpress_dir .
65+ return $ this -> getFileContents (
66+ ITEnv:: getWordPressDir () .
5867 '/wp-content/uploads/ ' .
59- $ this ->getOptionValue ( 'crawledSitePath ' );
60- $ content = file_get_contents ( "{$ crawled_site_dir }/ $ path " );
61- $ this ->assertNotFalse ( $ content , "Failed to read file: {$ crawled_site_dir }/ $ path " );
62- return $ content ;
68+ $ this ->getOptionValue ( 'crawledSitePath ' ),
69+ $ path
70+ );
6371 }
6472
6573 public function getProcessedFileContents ( string $ path ): string
6674 {
67- $ wordpress_dir = ITEnv:: getWordPressDir ();
68- $ processed_site_dir = $ wordpress_dir .
75+ return $ this -> getFileContents (
76+ ITEnv:: getWordPressDir () .
6977 '/wp-content/uploads/ ' .
70- $ this ->getOptionValue ( 'processedSitePath ' );
71- $ content = file_get_contents ( "{$ processed_site_dir }/ $ path " );
72- $ this ->assertNotFalse ( $ content , "Failed to read file: {$ processed_site_dir }/ $ path " );
73- return $ content ;
78+ $ this ->getOptionValue ( 'processedSitePath ' ),
79+ $ path
80+ );
7481 }
7582
7683 public function getOptionValue ( string $ option_name ): string {
0 commit comments