I might be missing something, but I have a very simple helper class that creates a directory:
// Helper class <?php namespace MyApp\Helpers; use User; use File; class FileSystemHelper { protected $userBin = 'users/uploads'; public function createUserUploadBin(User $user) { $path = $this->userBin . '/' . $user->id; if ( ! File::isDirectory($path)) { File::makeDirectory($path); } } }
And the related test is here:
// Associated test class <?php use MyApp\Helpers\FileSystemHelper; class FileSystemHelperTest extends TestCase { protected $fileSystemHelper; public function setUp() { $this->fileSystemHelper = new FileSystemHelper; } public function testNewUploadBinCreatedWhenNotExists() { $user = new User;
However, when I run the test, I get a fatal error:
PHP Fatal error: Class 'File' not found in /my/app/folder/app/tests/lib/myapp/helpers/FileSystemHelperTest.php
I looked through the documents for a mockery of the facade, and I do not see where I am mistaken. Any suggestions?
thanks
Russ back
source share