Skip to content

Commit 36759b5

Browse files
committed
Add local deploy dir to ITEnv and ITTrait
Add support for creating, clearing between test cases, and getting file contents from a local deploy directory.
1 parent e692aa3 commit 36759b5

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

tests/integration/ITEnv.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,10 @@ public static function getWordPressDir(): string
3737
}
3838
return self::$wordpress_dir;
3939
}
40+
41+
public static function getLocalDeployDir(): string {
42+
$dir = self::getWordPressDir() . '/../localdeploy';
43+
mkdir( $dir, 0775, true );
44+
return realpath( $dir );
45+
}
4046
}

tests/integration/ITTrait.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88
trait ITTrait {
99
public function setUp(): void {
10+
exec( 'rm -rf ' . escapeshellarg( ITEnv::getLocalDeployDir() ) );
1011
exec( 'rm -rf ' . escapeshellarg( ITEnv::getTestContentDir() ) );
1112

1213
$this->pluginCli( [ 'delete_all_cache', '--force' ] );
@@ -70,6 +71,13 @@ public function getCrawledFileContents( string $path ): string
7071
);
7172
}
7273

74+
public function getLocalDeployFileContents( string $path ): string {
75+
return $this->getFileContents(
76+
ITEnv::getLocalDeployDir(),
77+
$path
78+
);
79+
}
80+
7381
public function getProcessedFileContents( string $path ): string
7482
{
7583
return $this->getFileContents(

0 commit comments

Comments
 (0)