Auto creating the directory is a really good, but would it be ok for you to replace the $filesystem->mkdir() by a simple:

    if (mkdir($folder, 0777, true) === false) {
        throw new \InvalidArgumentException("Impossible to create the folder [$folder]");
    }

?

Like this, we keep the ability to move this class and its related tests into a separate library.