Skip to content

Commit ccc4e0b

Browse files
committed
Fix PluginPackagerTest for removed isCommonGitIgnoredPath method
Update two failing tests that called the removed isCommonGitIgnoredPath() method, which was eliminated in commit 6253871 when the packager was refactored to use .gitattributes export-ignore patterns as the single source of truth. Changes: - testBuiltAssetsNotIgnored: Now uses getExportIgnorePatterns() and shouldExcludePath() to verify assets/dist/ is included in packages - testVendorDirectoriesIgnored: Now uses getExportIgnorePatterns() and shouldExcludePath() to verify vendor/ is excluded from packages - Updated section comment to reflect the new .gitattributes approach The tests verify the same critical behaviors as before: - Built assets (assets/dist/) must NOT be excluded from packages - Dev dependencies (vendor/) must be excluded from packages - Similar directory names (vendor_custom/) must not be incorrectly matched
1 parent 0d837f6 commit ccc4e0b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

tests/Unit/PluginPackagerTest.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ public function testWindowsPathNormalization() :void {
123123
}
124124

125125
// =========================================================================
126-
// isCommonGitIgnoredPath() - Critical path handling
127-
// Only test the critical case that could break packages
126+
// .gitattributes export-ignore - Critical path handling
127+
// Verify export-ignore patterns correctly include/exclude critical paths
128128
// =========================================================================
129129

130130
/**
@@ -133,13 +133,14 @@ public function testWindowsPathNormalization() :void {
133133
*/
134134
public function testBuiltAssetsNotIgnored() :void {
135135
$packager = $this->createPackager();
136+
$patterns = $this->invokePrivateMethod( $packager, 'getExportIgnorePatterns', [] );
136137

137138
$this->assertFalse(
138-
$this->invokePrivateMethod( $packager, 'isCommonGitIgnoredPath', [ 'assets/dist/bundle.js' ] ),
139+
$this->invokePrivateMethod( $packager, 'shouldExcludePath', [ 'assets/dist/bundle.js', $patterns ] ),
139140
'assets/dist/ contains built JS/CSS - must be in package'
140141
);
141142
$this->assertFalse(
142-
$this->invokePrivateMethod( $packager, 'isCommonGitIgnoredPath', [ 'assets/dist' ] )
143+
$this->invokePrivateMethod( $packager, 'shouldExcludePath', [ 'assets/dist', $patterns ] )
143144
);
144145
}
145146

@@ -148,15 +149,16 @@ public function testBuiltAssetsNotIgnored() :void {
148149
*/
149150
public function testVendorDirectoriesIgnored() :void {
150151
$packager = $this->createPackager();
152+
$patterns = $this->invokePrivateMethod( $packager, 'getExportIgnorePatterns', [] );
151153

152154
// Root vendor/ contains dev dependencies
153155
$this->assertTrue(
154-
$this->invokePrivateMethod( $packager, 'isCommonGitIgnoredPath', [ 'vendor/phpunit/phpunit.php' ] )
156+
$this->invokePrivateMethod( $packager, 'shouldExcludePath', [ 'vendor/phpunit/phpunit.php', $patterns ] )
155157
);
156158

157159
// But vendor_custom/ (if it existed) should not match
158160
$this->assertFalse(
159-
$this->invokePrivateMethod( $packager, 'isCommonGitIgnoredPath', [ 'vendor_custom/file.php' ] ),
161+
$this->invokePrivateMethod( $packager, 'shouldExcludePath', [ 'vendor_custom/file.php', $patterns ] ),
160162
'Prefix match must not catch similar directory names'
161163
);
162164
}

0 commit comments

Comments
 (0)