Skip to content

Commit

Permalink
Use permission 0755 for vendor-prefixed
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHenryIE committed May 8, 2024
1 parent 1cdb99c commit c9fa47e
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Copier.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public function prepareTarget(): void
{
if (! is_dir($this->absoluteTargetDir)) {
$this->filesystem->createDirectory($this->absoluteTargetDir);
$this->filesystem->setVisibility($this->absoluteTargetDir, 'public');
} else {
foreach ($this->files->getFiles() as $file) {
$targetAbsoluteFilepath = $this->absoluteTargetDir . $file->getTargetRelativePath();
Expand Down
46 changes: 46 additions & 0 deletions tests/Issues/StraussIssue104Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php
/**
* `vendor-prefixed` directory permissions changed after Flysystem update.
*
* @see https://github.com/BrianHenryIE/strauss/issues/104
*/

namespace BrianHenryIE\Strauss\Tests\Issues;

use BrianHenryIE\Strauss\Tests\Integration\Util\IntegrationTestCase;

/**
* @package BrianHenryIE\Strauss\Tests\Issues
* @coversNothing
*/
class StraussIssue104Test extends IntegrationTestCase
{
public function test_correct_directory_permission()
{
$composerJsonString = <<<'EOD'
{
"name": "strauss/issue104",
"require": {
"psr/log": "1.0.0"
},
"extra": {
"strauss": {
"namespace_prefix": "Strauss\\Issue104\\"
}
}
}
EOD;

chdir($this->testsWorkingDir);

file_put_contents($this->testsWorkingDir . '/composer.json', $composerJsonString);

exec('composer install');

$this->runStrauss();

$result = substr(sprintf('%o', fileperms($this->testsWorkingDir . '/vendor-prefixed')), -4);

self::assertEquals('0755', $result);
}
}

0 comments on commit c9fa47e

Please sign in to comment.