From e46b40a8b72bb48ee332fdeafe51362930d2e740 Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Wed, 9 May 2018 10:27:29 +0800 Subject: [PATCH] Update user photo helper test Image directory should be created before copying dummy image file. --- .travis.yml | 1 + tests/Unit/Helpers/UserPhotoHelperTest.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 6fd0b19..feb0c88 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ before_script: - travis_retry composer install --prefer-source --no-interaction --dev - cp .env.example .env - php artisan key:generate + - php artisan storage:link script: - vendor/bin/phpunit diff --git a/tests/Unit/Helpers/UserPhotoHelperTest.php b/tests/Unit/Helpers/UserPhotoHelperTest.php index c370ac6..cdd0cb0 100644 --- a/tests/Unit/Helpers/UserPhotoHelperTest.php +++ b/tests/Unit/Helpers/UserPhotoHelperTest.php @@ -54,6 +54,9 @@ class UserPhotoHelperTest extends TestCase { $photoPath = 'images/user_photo_path.jpg'; + if (!is_dir(storage_path('app/public/images'))) { + mkdir(storage_path('app/public/images'), 0700); + } copy(public_path('images/icon_user_1.png'), storage_path('app/public/images/user_photo_path.jpg')); $this->assertFileExists(storage_path('app/public/images/user_photo_path.jpg'));