public function testRename() { $pathOld = 'temp/the-file-formerly-known-as.txt'; $pathNew = 'temp/the-file.txt'; $file = new File($this->filesystem, $pathOld); $this->assertFalse($file->exists()); $file->write('Writing tests is so much fun… everyone should do it!'); $file->rename($pathNew); $newFile = new File($this->filesystem, $pathNew); $this->assertSame('Writing tests is so much fun… everyone should do it!', $newFile->read()); }
/** * Attempt to save the serialised exception if in debug mode. * * @param \Exception $exception */ protected function saveException(\Exception $exception) { if ($this->app['debug'] !== true) { return; } $environment = $this->app['environment']; $serialised = serialize(FlattenException::create($exception)); $sourceFile = Slugify::create()->slugify($exception->getFile()); $fileName = sprintf('%s-%s.exception', Carbon::now()->format('Ymd-Hmi'), substr($sourceFile, -102)); $fullPath = sprintf('%s/exception/%s', $environment, $fileName); $cacheFilesystem = $this->app['filesystem']->getFilesystem('cache'); $file = new File($cacheFilesystem, $fullPath); $file->write($serialised); }