word(); $fs = Storage::fake(fake()->word()); $fs->makeDirectory($directory); $attribute = fake()->word(); $validator = Validator::make( [$attribute => $directory], [$attribute => new StorageDirectoryExistsRule($fs)] ); $this->assertTrue($validator->passes()); }); test('fails if directory does not exist', function () { $fs = Storage::fake(fake()->word()); $attribute = fake()->word(); $validator = Validator::make( [$attribute => fake()->word()], [$attribute => new StorageDirectoryExistsRule($fs)] ); $this->assertFalse($validator->passes()); });