From da23bb4100e97f02d9ff9e0bdd9b52279f62830d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kv=C3=A1=C4=8Dek?= Date: Thu, 28 Jan 2016 20:51:35 +0100 Subject: [PATCH] TESTING: add tests for writing into bootstrap/cache and storage directories --- tests/ExampleTest.php | 19 --------------- tests/WritePermissionsTest.php | 43 ++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 19 deletions(-) delete mode 100644 tests/ExampleTest.php create mode 100644 tests/WritePermissionsTest.php diff --git a/tests/ExampleTest.php b/tests/ExampleTest.php deleted file mode 100644 index 7e81d37a..00000000 --- a/tests/ExampleTest.php +++ /dev/null @@ -1,19 +0,0 @@ -visit('/') - ->see('Laravel 5'); - } -} diff --git a/tests/WritePermissionsTest.php b/tests/WritePermissionsTest.php new file mode 100644 index 00000000..107304a4 --- /dev/null +++ b/tests/WritePermissionsTest.php @@ -0,0 +1,43 @@ +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); + } +}