Skip to content

Commit

Permalink
bug: Fixed unmanaged files incorrectly working with directories. (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk authored Apr 24, 2023
1 parent fce663f commit 0e746db
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/FileTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,10 @@ protected function fileLoadMultiple(array $conditions = []) {
* @Given unmanaged file :uri created
*/
public function fileCreateUnmanaged($uri, $content = 'test') {
$dir = dirname($uri);
$dir = \Drupal::service('file_system')->dirname($uri);

if (!file_exists($dir)) {
mkdir($dir, 0770, TRUE);
$dir = \Drupal::service('file_system')->dirname($dir, 0770, TRUE);
}

file_put_contents($uri, $content);
Expand Down

0 comments on commit 0e746db

Please sign in to comment.