Files
core/tests/WritePermissionsTest.php
Michal Kváček 24144f6aa4 FEATURE #1337: add file upload
This commit registers new items into admin menu and adds functionality for uploading files.
2016-02-08 14:27:43 +01:00

48 lines
1011 B
PHP

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