TESTING: add tests for writing into bootstrap/cache and storage directories
This commit is contained in:
@@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
|
||||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
|
||||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
|
||||||
|
|
||||||
class ExampleTest extends TestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic functional test example.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testBasicExample()
|
|
||||||
{
|
|
||||||
$this->visit('/')
|
|
||||||
->see('Laravel 5');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?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);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user