44 lines
878 B
PHP
44 lines
878 B
PHP
<?php
|
|
|
|
class WritePermissionsTest extends TestCase
|
|
{
|
|
public function testStorageDir()
|
|
{
|
|
$this->writeToDir('test.txt');
|
|
}
|
|
|
|
public function testLogsDir()
|
|
{
|
|
$this->writeToDir('logs/test.txt');
|
|
}
|
|
|
|
public function testFrameworkDir()
|
|
{
|
|
$this->writeToDir('framework/test.txt');
|
|
}
|
|
|
|
public function testBootstrapCacheDir()
|
|
{
|
|
$this->writeToDir('../bootstrap/cache/test.txt');
|
|
}
|
|
|
|
/**
|
|
* Create and delete some file
|
|
*
|
|
* @param $path
|
|
*/
|
|
protected function writeToDir($path)
|
|
{
|
|
$file = storage_path($path);
|
|
$content = uniqid();
|
|
$bytesWritten = @file_put_contents($file, $content);
|
|
|
|
// test writing
|
|
$this->assertNotFalse($bytesWritten);
|
|
|
|
// test deleting
|
|
$deleted = @unlink($file);
|
|
$this->assertTrue($deleted);
|
|
}
|
|
}
|