From 00908b93c4d870c8fe2cec43aaf3114411a5c6df Mon Sep 17 00:00:00 2001 From: Percy Mamedy Date: Thu, 7 Mar 2019 22:51:00 +0400 Subject: [PATCH] Issue #2 - Added test for generate-tools command and refactored the command to make it cleaner. - Added test for init-command. --- app/Commands/GenerateCommandLineTools.php | 30 +- app/Support/Artifacts/AbstractArtifact.php | 18 ++ app/Support/Artifacts/Artifact.php | 23 ++ app/Support/Artifacts/Containers.php | 66 +++++ app/Support/Concerns/CommandResponsable.php | 38 +++ app/Support/helpers.php | 27 ++ composer.lock | 306 ++++++++++---------- config/filesystems.php | 4 +- tests/CreatesApplication.php | 3 + tests/Feature/GenerateCommandTest.php | 35 +++ tests/Feature/InitCommandTest.php | 26 ++ tests/Feature/InspiringCommandTest.php | 20 -- tests/fixtures/work_dir/.gitignore | 2 + 13 files changed, 403 insertions(+), 195 deletions(-) create mode 100644 app/Support/Artifacts/AbstractArtifact.php create mode 100644 app/Support/Artifacts/Artifact.php create mode 100644 app/Support/Artifacts/Containers.php create mode 100644 app/Support/Concerns/CommandResponsable.php create mode 100755 tests/Feature/GenerateCommandTest.php create mode 100644 tests/Feature/InitCommandTest.php delete mode 100755 tests/Feature/InspiringCommandTest.php create mode 100644 tests/fixtures/work_dir/.gitignore diff --git a/app/Commands/GenerateCommandLineTools.php b/app/Commands/GenerateCommandLineTools.php index deae58c..5ba3788 100644 --- a/app/Commands/GenerateCommandLineTools.php +++ b/app/Commands/GenerateCommandLineTools.php @@ -2,12 +2,14 @@ namespace App\Commands; -use Illuminate\Filesystem\Filesystem; -use Illuminate\Support\Facades\Storage; +use App\Support\Artifacts\Containers; use LaravelZero\Framework\Commands\Command; +use App\Support\Concerns\CommandResponsable; class GenerateCommandLineTools extends Command { + use CommandResponsable; + /** * The signature of the command. * @@ -29,26 +31,8 @@ class GenerateCommandLineTools extends Command */ public function handle() { - // Copy file to Working directory. - Storage::disk('work_dir')->put('containers', $this->getContainersFileContents()); - - // Make file executed. - app(Filesystem::class)->chmod( - Storage::disk('work_dir')->path('containers'), 0755 - ); - - $this->info('containers script generated!'); - - return true; - } - - /** - * Get the command line tools content. - * - * @return string - */ - protected function getContainersFileContents(): string - { - return file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'containers.stub'); + return Containers::make()->save() ? + $this->sendSuccessResponse('containers script generated!') : + $this->sendErrorResponse('Could generate containers script!'); } } diff --git a/app/Support/Artifacts/AbstractArtifact.php b/app/Support/Artifacts/AbstractArtifact.php new file mode 100644 index 0000000..c11ff26 --- /dev/null +++ b/app/Support/Artifacts/AbstractArtifact.php @@ -0,0 +1,18 @@ +stub = $stubPath ?? $this->stubDefaultPath(); + } + + /** + * Saves the artifact and return true + * if saved was successful. + * + * @return bool + */ + public function save(): bool + { + // Copy file to Working directory. + $wasSaved = Storage::disk('work_dir')->put('containers', $this->stubContents()); + + // Make file executed. + app(Filesystem::class)->chmod( + Storage::disk('work_dir')->path('containers'), 0755 + ); + + return $wasSaved; + } + + /** + * Get the command line tools content. + * + * @return string + */ + protected function stubContents(): string + { + return file_get_contents($this->stub); + } + + /** + * Get the default path where containers stub is + * stored. + * + * @return string + */ + protected function stubDefaultPath(): string + { + return app_path('Commands' . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'containers.stub'); + } +} diff --git a/app/Support/Concerns/CommandResponsable.php b/app/Support/Concerns/CommandResponsable.php new file mode 100644 index 0000000..48929b2 --- /dev/null +++ b/app/Support/Concerns/CommandResponsable.php @@ -0,0 +1,38 @@ +info($message); + + return true; + } + + /** + * Show an error message and then exits the program. + * + * @param string $message + * + * @return bool + */ + protected function sendErrorResponse(string $message = null): bool + { + $message = $message ?? 'Command failed !'; + + $this->error($message); + + return false; + } +} diff --git a/app/Support/helpers.php b/app/Support/helpers.php index d61ab75..cf9b9a0 100644 --- a/app/Support/helpers.php +++ b/app/Support/helpers.php @@ -27,6 +27,33 @@ function home_dir() } } +if (!function_exists('work_dir')) { + /** + * Return the project directory. + * + * @return string + */ + function work_dir() + { + return getenv('APP_ENV') === 'testing' ? + realpath(__DIR__ . '/../../tests/fixtures/work_dir') : + getcwd(); + } +} + +if (!function_exists('docker_dir')) { + /** + * Return the directory in which all + * docker assets will be saved. + * + * @return string + */ + function docker_dir() + { + return work_dir() . DIRECTORY_SEPARATOR . '.docker'; + } +} + if (!function_exists('ddd')) { /** * Advanced dumped and die. diff --git a/composer.lock b/composer.lock index df30cdc..d0ab662 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "73b72cfd0af46be2145222b3506eaf71", + "content-hash": "4e35f003311b57a5a3702357dc92d487", "packages": [ { "name": "beberlei/assert", @@ -454,16 +454,16 @@ }, { "name": "illuminate/cache", - "version": "v5.7.20", + "version": "v5.7.28", "source": { "type": "git", "url": "https://github.com/illuminate/cache.git", - "reference": "703fd21e1b88f78c37328383b96651d470d4e273" + "reference": "7998b137cc723dd5e68846ada33f8c0143f5b10f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/cache/zipball/703fd21e1b88f78c37328383b96651d470d4e273", - "reference": "703fd21e1b88f78c37328383b96651d470d4e273", + "url": "https://api.github.com/repos/illuminate/cache/zipball/7998b137cc723dd5e68846ada33f8c0143f5b10f", + "reference": "7998b137cc723dd5e68846ada33f8c0143f5b10f", "shasum": "" }, "require": { @@ -499,20 +499,20 @@ ], "description": "The Illuminate Cache package.", "homepage": "https://laravel.com", - "time": "2018-12-03T12:45:57+00:00" + "time": "2019-02-11T13:48:57+00:00" }, { "name": "illuminate/config", - "version": "v5.7.20", + "version": "v5.7.28", "source": { "type": "git", "url": "https://github.com/illuminate/config.git", - "reference": "08b6e422d62602ee5263ca2113e9f3d800e905a4" + "reference": "540e11b9ae058c9a94051d9ca6c02e40258c71fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/config/zipball/08b6e422d62602ee5263ca2113e9f3d800e905a4", - "reference": "08b6e422d62602ee5263ca2113e9f3d800e905a4", + "url": "https://api.github.com/repos/illuminate/config/zipball/540e11b9ae058c9a94051d9ca6c02e40258c71fd", + "reference": "540e11b9ae058c9a94051d9ca6c02e40258c71fd", "shasum": "" }, "require": { @@ -543,20 +543,20 @@ ], "description": "The Illuminate Config package.", "homepage": "https://laravel.com", - "time": "2018-10-06T18:48:42+00:00" + "time": "2019-02-11T13:48:57+00:00" }, { "name": "illuminate/console", - "version": "v5.7.20", + "version": "v5.7.28", "source": { "type": "git", "url": "https://github.com/illuminate/console.git", - "reference": "7d5d3e658fef12021ce997a38d5d17381ee5ec39" + "reference": "0d97b6ead0cbb09140b1e8317f5a9d9f69ff9ec6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/console/zipball/7d5d3e658fef12021ce997a38d5d17381ee5ec39", - "reference": "7d5d3e658fef12021ce997a38d5d17381ee5ec39", + "url": "https://api.github.com/repos/illuminate/console/zipball/0d97b6ead0cbb09140b1e8317f5a9d9f69ff9ec6", + "reference": "0d97b6ead0cbb09140b1e8317f5a9d9f69ff9ec6", "shasum": "" }, "require": { @@ -593,20 +593,20 @@ ], "description": "The Illuminate Console package.", "homepage": "https://laravel.com", - "time": "2019-01-04T15:39:20+00:00" + "time": "2019-02-11T13:48:57+00:00" }, { "name": "illuminate/container", - "version": "v5.7.20", + "version": "v5.7.28", "source": { "type": "git", "url": "https://github.com/illuminate/container.git", - "reference": "53a0991e918efaace42cde526a04fdb832128a03" + "reference": "8c3a75e464d59509ae88db152cab61a3f115b9ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/container/zipball/53a0991e918efaace42cde526a04fdb832128a03", - "reference": "53a0991e918efaace42cde526a04fdb832128a03", + "url": "https://api.github.com/repos/illuminate/container/zipball/8c3a75e464d59509ae88db152cab61a3f115b9ec", + "reference": "8c3a75e464d59509ae88db152cab61a3f115b9ec", "shasum": "" }, "require": { @@ -638,20 +638,20 @@ ], "description": "The Illuminate Container package.", "homepage": "https://laravel.com", - "time": "2018-12-18T14:00:02+00:00" + "time": "2019-02-11T13:48:57+00:00" }, { "name": "illuminate/contracts", - "version": "v5.7.20", + "version": "v5.7.28", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", - "reference": "758927e5e925c1d442a1faaa1356675ceba0194c" + "reference": "b63324d349a8ae2156fbc2697c1ccc85879b3803" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/contracts/zipball/758927e5e925c1d442a1faaa1356675ceba0194c", - "reference": "758927e5e925c1d442a1faaa1356675ceba0194c", + "url": "https://api.github.com/repos/illuminate/contracts/zipball/b63324d349a8ae2156fbc2697c1ccc85879b3803", + "reference": "b63324d349a8ae2156fbc2697c1ccc85879b3803", "shasum": "" }, "require": { @@ -682,20 +682,20 @@ ], "description": "The Illuminate Contracts package.", "homepage": "https://laravel.com", - "time": "2018-11-15T13:49:08+00:00" + "time": "2019-02-12T07:46:48+00:00" }, { "name": "illuminate/events", - "version": "v5.7.20", + "version": "v5.7.28", "source": { "type": "git", "url": "https://github.com/illuminate/events.git", - "reference": "a8e5e3d601ad7f3571428176a578ddf03ce649d8" + "reference": "e48888062a9962f30c431524357b9a815b093609" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/events/zipball/a8e5e3d601ad7f3571428176a578ddf03ce649d8", - "reference": "a8e5e3d601ad7f3571428176a578ddf03ce649d8", + "url": "https://api.github.com/repos/illuminate/events/zipball/e48888062a9962f30c431524357b9a815b093609", + "reference": "e48888062a9962f30c431524357b9a815b093609", "shasum": "" }, "require": { @@ -727,20 +727,20 @@ ], "description": "The Illuminate Events package.", "homepage": "https://laravel.com", - "time": "2018-10-06T18:48:42+00:00" + "time": "2019-02-11T13:48:57+00:00" }, { "name": "illuminate/filesystem", - "version": "v5.7.20", + "version": "v5.7.28", "source": { "type": "git", "url": "https://github.com/illuminate/filesystem.git", - "reference": "19ba2ac5f85b7505d7c2bf6307d10633f9f3c6b0" + "reference": "ff853e678a93996b1d0a3ddc6fc56c10bae0de30" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/filesystem/zipball/19ba2ac5f85b7505d7c2bf6307d10633f9f3c6b0", - "reference": "19ba2ac5f85b7505d7c2bf6307d10633f9f3c6b0", + "url": "https://api.github.com/repos/illuminate/filesystem/zipball/ff853e678a93996b1d0a3ddc6fc56c10bae0de30", + "reference": "ff853e678a93996b1d0a3ddc6fc56c10bae0de30", "shasum": "" }, "require": { @@ -779,20 +779,20 @@ ], "description": "The Illuminate Filesystem package.", "homepage": "https://laravel.com", - "time": "2018-12-28T14:33:29+00:00" + "time": "2019-02-11T13:48:57+00:00" }, { "name": "illuminate/support", - "version": "v5.7.20", + "version": "v5.7.28", "source": { "type": "git", "url": "https://github.com/illuminate/support.git", - "reference": "ea3f30dd824bba52bcff4290dc7431b0ffb478e1" + "reference": "3e2810145f37eb89fa11759781ee88ee1c1a5262" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/ea3f30dd824bba52bcff4290dc7431b0ffb478e1", - "reference": "ea3f30dd824bba52bcff4290dc7431b0ffb478e1", + "url": "https://api.github.com/repos/illuminate/support/zipball/3e2810145f37eb89fa11759781ee88ee1c1a5262", + "reference": "3e2810145f37eb89fa11759781ee88ee1c1a5262", "shasum": "" }, "require": { @@ -838,7 +838,7 @@ ], "description": "The Illuminate Support package.", "homepage": "https://laravel.com", - "time": "2019-01-07T13:39:07+00:00" + "time": "2019-02-12T07:57:07+00:00" }, { "name": "jakub-onderka/php-console-color", @@ -986,16 +986,16 @@ }, { "name": "laravel-zero/foundation", - "version": "v5.7.15", + "version": "v5.7.21", "source": { "type": "git", "url": "https://github.com/laravel-zero/foundation.git", - "reference": "ffaa847e3505f37e1b5121c16a8230d4611abf7e" + "reference": "8924b09005eb42d2cdde7c7be05b5a178ef5af96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel-zero/foundation/zipball/ffaa847e3505f37e1b5121c16a8230d4611abf7e", - "reference": "ffaa847e3505f37e1b5121c16a8230d4611abf7e", + "url": "https://api.github.com/repos/laravel-zero/foundation/zipball/8924b09005eb42d2cdde7c7be05b5a178ef5af96", + "reference": "8924b09005eb42d2cdde7c7be05b5a178ef5af96", "shasum": "" }, "require": { @@ -1019,20 +1019,20 @@ "framework", "laravel" ], - "time": "2018-12-04T21:38:39+00:00" + "time": "2019-01-17T15:13:44+00:00" }, { "name": "laravel-zero/framework", - "version": "v5.7.19", + "version": "v5.7.20", "source": { "type": "git", "url": "https://github.com/laravel-zero/framework.git", - "reference": "a938a5a1d7542b5689778c69a51aa7da94cc9048" + "reference": "f958a0fa8f9353e36640152953c4be2c3ab71949" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel-zero/framework/zipball/a938a5a1d7542b5689778c69a51aa7da94cc9048", - "reference": "a938a5a1d7542b5689778c69a51aa7da94cc9048", + "url": "https://api.github.com/repos/laravel-zero/framework/zipball/f958a0fa8f9353e36640152953c4be2c3ab71949", + "reference": "f958a0fa8f9353e36640152953c4be2c3ab71949", "shasum": "" }, "require": { @@ -1095,20 +1095,20 @@ "framework", "laravel" ], - "time": "2019-01-04T16:03:17+00:00" + "time": "2019-02-11T07:47:09+00:00" }, { "name": "league/flysystem", - "version": "1.0.49", + "version": "1.0.50", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "a63cc83d8a931b271be45148fa39ba7156782ffd" + "reference": "dab4e7624efa543a943be978008f439c333f2249" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/a63cc83d8a931b271be45148fa39ba7156782ffd", - "reference": "a63cc83d8a931b271be45148fa39ba7156782ffd", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/dab4e7624efa543a943be978008f439c333f2249", + "reference": "dab4e7624efa543a943be978008f439c333f2249", "shasum": "" }, "require": { @@ -1179,7 +1179,7 @@ "sftp", "storage" ], - "time": "2018-11-23T23:41:29+00:00" + "time": "2019-02-01T08:50:36+00:00" }, { "name": "nesbot/carbon", @@ -1305,21 +1305,21 @@ }, { "name": "nunomaduro/laravel-console-menu", - "version": "v2.0.1", + "version": "v2.1.0", "source": { "type": "git", "url": "https://github.com/nunomaduro/laravel-console-menu.git", - "reference": "303cf565be9ac88ef38680d4b9197149dcfa9f26" + "reference": "51579f17ee28e37861e297f03a10727465b57ab4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nunomaduro/laravel-console-menu/zipball/303cf565be9ac88ef38680d4b9197149dcfa9f26", - "reference": "303cf565be9ac88ef38680d4b9197149dcfa9f26", + "url": "https://api.github.com/repos/nunomaduro/laravel-console-menu/zipball/51579f17ee28e37861e297f03a10727465b57ab4", + "reference": "51579f17ee28e37861e297f03a10727465b57ab4", "shasum": "" }, "require": { - "illuminate/console": "5.6.*|5.7.*", - "illuminate/support": "5.6.*|5.7.*", + "illuminate/console": "5.6.*|5.7.*|5.8.*", + "illuminate/support": "5.6.*|5.7.*|5.8.*", "php": "^7.1.3", "php-school/cli-menu": "^3.0" }, @@ -1357,25 +1357,25 @@ "php", "symfony" ], - "time": "2018-10-14T13:14:31+00:00" + "time": "2019-02-26T20:30:23+00:00" }, { "name": "nunomaduro/laravel-console-summary", - "version": "v1.0.4", + "version": "v1.1.0", "source": { "type": "git", "url": "https://github.com/nunomaduro/laravel-console-summary.git", - "reference": "dd3be06e03946137f98670d00f5d10e89a5f3cf2" + "reference": "fac5ca9f0d9dc184996f37cf371c680048f8cbef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nunomaduro/laravel-console-summary/zipball/dd3be06e03946137f98670d00f5d10e89a5f3cf2", - "reference": "dd3be06e03946137f98670d00f5d10e89a5f3cf2", + "url": "https://api.github.com/repos/nunomaduro/laravel-console-summary/zipball/fac5ca9f0d9dc184996f37cf371c680048f8cbef", + "reference": "fac5ca9f0d9dc184996f37cf371c680048f8cbef", "shasum": "" }, "require": { - "illuminate/console": "5.6.*|5.7.*", - "illuminate/support": "5.6.*|5.7.*", + "illuminate/console": "5.6.*|5.7.*|5.8.*", + "illuminate/support": "5.6.*|5.7.*|5.8.*", "php": ">=7.1.3" }, "type": "library", @@ -1412,25 +1412,25 @@ "php", "symfony" ], - "time": "2018-08-26T23:04:18+00:00" + "time": "2019-01-23T19:04:32+00:00" }, { "name": "nunomaduro/laravel-console-task", - "version": "v1.1.0", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/nunomaduro/laravel-console-task.git", - "reference": "84bc8bd88003f145a801f143bc58e0573b65877b" + "reference": "712bda357b6fd09e54ff2f8d37de2188982ef4fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nunomaduro/laravel-console-task/zipball/84bc8bd88003f145a801f143bc58e0573b65877b", - "reference": "84bc8bd88003f145a801f143bc58e0573b65877b", + "url": "https://api.github.com/repos/nunomaduro/laravel-console-task/zipball/712bda357b6fd09e54ff2f8d37de2188982ef4fd", + "reference": "712bda357b6fd09e54ff2f8d37de2188982ef4fd", "shasum": "" }, "require": { - "illuminate/console": "~5.5.26|5.6.*|5.7.*", - "illuminate/support": "~5.5.26|5.6.*|5.7.*", + "illuminate/console": "~5.5.26|5.6.*|5.7.*|5.8.*", + "illuminate/support": "~5.5.26|5.6.*|5.7.*|5.8.*", "php": "^7.0" }, "require-dev": { @@ -1470,25 +1470,25 @@ "php", "symfony" ], - "time": "2018-12-17T21:22:07+00:00" + "time": "2019-01-23T18:08:55+00:00" }, { "name": "nunomaduro/laravel-desktop-notifier", - "version": "v2.0.6", + "version": "v2.1.0", "source": { "type": "git", "url": "https://github.com/nunomaduro/laravel-desktop-notifier.git", - "reference": "9cf87364f021c3d411770cb34e46e6a656dab928" + "reference": "50a91b569268770647e3f4e9cfeaeb7bfb77ae26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nunomaduro/laravel-desktop-notifier/zipball/9cf87364f021c3d411770cb34e46e6a656dab928", - "reference": "9cf87364f021c3d411770cb34e46e6a656dab928", + "url": "https://api.github.com/repos/nunomaduro/laravel-desktop-notifier/zipball/50a91b569268770647e3f4e9cfeaeb7bfb77ae26", + "reference": "50a91b569268770647e3f4e9cfeaeb7bfb77ae26", "shasum": "" }, "require": { - "illuminate/console": "5.6.*|5.7.*", - "illuminate/support": "5.6.*|5.7.*", + "illuminate/console": "5.6.*|5.7.*|5.8.*", + "illuminate/support": "5.6.*|5.7.*|5.8.*", "jolicode/jolinotif": "^2.0", "php": "^7.1.3" }, @@ -1536,7 +1536,7 @@ "php", "wrapper" ], - "time": "2018-08-26T22:58:22+00:00" + "time": "2019-01-23T18:58:44+00:00" }, { "name": "php-school/cli-menu", @@ -1883,16 +1883,16 @@ }, { "name": "symfony/console", - "version": "v4.2.2", + "version": "v4.2.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "b0a03c1bb0fcbe288629956cf2f1dd3f1dc97522" + "reference": "9dc2299a016497f9ee620be94524e6c0af0280a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/b0a03c1bb0fcbe288629956cf2f1dd3f1dc97522", - "reference": "b0a03c1bb0fcbe288629956cf2f1dd3f1dc97522", + "url": "https://api.github.com/repos/symfony/console/zipball/9dc2299a016497f9ee620be94524e6c0af0280a9", + "reference": "9dc2299a016497f9ee620be94524e6c0af0280a9", "shasum": "" }, "require": { @@ -1904,6 +1904,9 @@ "symfony/dependency-injection": "<3.4", "symfony/process": "<3.3" }, + "provide": { + "psr/log-implementation": "1.0" + }, "require-dev": { "psr/log": "~1.0", "symfony/config": "~3.4|~4.0", @@ -1913,7 +1916,7 @@ "symfony/process": "~3.4|~4.0" }, "suggest": { - "psr/log-implementation": "For using the console logger", + "psr/log": "For using the console logger", "symfony/event-dispatcher": "", "symfony/lock": "", "symfony/process": "" @@ -1948,7 +1951,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2019-01-04T15:13:53+00:00" + "time": "2019-02-23T15:17:42+00:00" }, { "name": "symfony/contracts", @@ -2020,16 +2023,16 @@ }, { "name": "symfony/debug", - "version": "v4.2.2", + "version": "v4.2.4", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "64cb33c81e37d19b7715d4a6a4d49c1c382066dd" + "reference": "de73f48977b8eaf7ce22814d66e43a1662cc864f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/64cb33c81e37d19b7715d4a6a4d49c1c382066dd", - "reference": "64cb33c81e37d19b7715d4a6a4d49c1c382066dd", + "url": "https://api.github.com/repos/symfony/debug/zipball/de73f48977b8eaf7ce22814d66e43a1662cc864f", + "reference": "de73f48977b8eaf7ce22814d66e43a1662cc864f", "shasum": "" }, "require": { @@ -2072,20 +2075,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2019-01-03T09:07:35+00:00" + "time": "2019-03-03T18:11:24+00:00" }, { "name": "symfony/finder", - "version": "v4.2.2", + "version": "v4.2.4", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "9094d69e8c6ee3fe186a0ec5a4f1401e506071ce" + "reference": "267b7002c1b70ea80db0833c3afe05f0fbde580a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/9094d69e8c6ee3fe186a0ec5a4f1401e506071ce", - "reference": "9094d69e8c6ee3fe186a0ec5a4f1401e506071ce", + "url": "https://api.github.com/repos/symfony/finder/zipball/267b7002c1b70ea80db0833c3afe05f0fbde580a", + "reference": "267b7002c1b70ea80db0833c3afe05f0fbde580a", "shasum": "" }, "require": { @@ -2121,7 +2124,7 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2019-01-03T09:07:35+00:00" + "time": "2019-02-23T15:42:05+00:00" }, { "name": "symfony/polyfill-ctype", @@ -2297,16 +2300,16 @@ }, { "name": "symfony/process", - "version": "v4.2.2", + "version": "v4.2.4", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "ea043ab5d8ed13b467a9087d81cb876aee7f689a" + "reference": "6c05edb11fbeff9e2b324b4270ecb17911a8b7ad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/ea043ab5d8ed13b467a9087d81cb876aee7f689a", - "reference": "ea043ab5d8ed13b467a9087d81cb876aee7f689a", + "url": "https://api.github.com/repos/symfony/process/zipball/6c05edb11fbeff9e2b324b4270ecb17911a8b7ad", + "reference": "6c05edb11fbeff9e2b324b4270ecb17911a8b7ad", "shasum": "" }, "require": { @@ -2342,20 +2345,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2019-01-03T14:48:52+00:00" + "time": "2019-01-24T22:05:03+00:00" }, { "name": "symfony/translation", - "version": "v4.2.2", + "version": "v4.2.4", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "939fb792d73f2ce80e6ae9019d205fc480f1c9a0" + "reference": "748464177a77011f8f4cdd076773862ce4915f8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/939fb792d73f2ce80e6ae9019d205fc480f1c9a0", - "reference": "939fb792d73f2ce80e6ae9019d205fc480f1c9a0", + "url": "https://api.github.com/repos/symfony/translation/zipball/748464177a77011f8f4cdd076773862ce4915f8f", + "reference": "748464177a77011f8f4cdd076773862ce4915f8f", "shasum": "" }, "require": { @@ -2415,20 +2418,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2019-01-03T09:07:35+00:00" + "time": "2019-02-27T03:31:50+00:00" }, { "name": "symfony/var-dumper", - "version": "v4.2.2", + "version": "v4.2.4", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "85bde661b178173d85c6f11ea9d03b61d1212bb2" + "reference": "9f87189ac10b42edf7fb8edc846f1937c6d157cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/85bde661b178173d85c6f11ea9d03b61d1212bb2", - "reference": "85bde661b178173d85c6f11ea9d03b61d1212bb2", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/9f87189ac10b42edf7fb8edc846f1937c6d157cf", + "reference": "9f87189ac10b42edf7fb8edc846f1937c6d157cf", "shasum": "" }, "require": { @@ -2491,20 +2494,20 @@ "debug", "dump" ], - "time": "2019-01-03T09:07:35+00:00" + "time": "2019-02-23T15:17:42+00:00" }, { "name": "symfony/yaml", - "version": "v4.2.2", + "version": "v4.2.4", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "d0aa6c0ea484087927b49fd513383a7d36190ca6" + "reference": "761fa560a937fd7686e5274ff89dcfa87a5047df" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/d0aa6c0ea484087927b49fd513383a7d36190ca6", - "reference": "d0aa6c0ea484087927b49fd513383a7d36190ca6", + "url": "https://api.github.com/repos/symfony/yaml/zipball/761fa560a937fd7686e5274ff89dcfa87a5047df", + "reference": "761fa560a937fd7686e5274ff89dcfa87a5047df", "shasum": "" }, "require": { @@ -2550,7 +2553,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2019-01-03T09:07:35+00:00" + "time": "2019-02-23T15:17:42+00:00" }, { "name": "zendframework/zend-servicemanager", @@ -2890,16 +2893,16 @@ }, { "name": "mockery/mockery", - "version": "1.2.0", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "100633629bf76d57430b86b7098cd6beb996a35a" + "reference": "0eb0b48c3f07b3b89f5169ce005b7d05b18cf1d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/100633629bf76d57430b86b7098cd6beb996a35a", - "reference": "100633629bf76d57430b86b7098cd6beb996a35a", + "url": "https://api.github.com/repos/mockery/mockery/zipball/0eb0b48c3f07b3b89f5169ce005b7d05b18cf1d2", + "reference": "0eb0b48c3f07b3b89f5169ce005b7d05b18cf1d2", "shasum": "" }, "require": { @@ -2908,7 +2911,7 @@ "php": ">=5.6.0" }, "require-dev": { - "phpunit/phpunit": "~5.7.10|~6.5|~7.0" + "phpunit/phpunit": "~5.7.10|~6.5|~7.0|~8.0" }, "type": "library", "extra": { @@ -2951,7 +2954,7 @@ "test double", "testing" ], - "time": "2018-10-02T21:52:37+00:00" + "time": "2019-02-13T09:37:52+00:00" }, { "name": "myclabs/deep-copy", @@ -3474,16 +3477,16 @@ }, { "name": "phpunit/php-timer", - "version": "2.0.0", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f" + "reference": "8b389aebe1b8b0578430bda0c7c95a829608e059" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/8b8454ea6958c3dee38453d3bd571e023108c91f", - "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/8b389aebe1b8b0578430bda0c7c95a829608e059", + "reference": "8b389aebe1b8b0578430bda0c7c95a829608e059", "shasum": "" }, "require": { @@ -3495,7 +3498,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "2.1-dev" } }, "autoload": { @@ -3519,7 +3522,7 @@ "keywords": [ "timer" ], - "time": "2018-02-01T13:07:23+00:00" + "time": "2019-02-20T10:12:59+00:00" }, { "name": "phpunit/php-token-stream", @@ -3572,16 +3575,16 @@ }, { "name": "phpunit/phpunit", - "version": "7.5.1", + "version": "7.5.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c23d78776ad415d5506e0679723cb461d71f488f" + "reference": "09c85e14994df92e5ff1f5ec0b481bdb7d3d3df9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c23d78776ad415d5506e0679723cb461d71f488f", - "reference": "c23d78776ad415d5506e0679723cb461d71f488f", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/09c85e14994df92e5ff1f5ec0b481bdb7d3d3df9", + "reference": "09c85e14994df92e5ff1f5ec0b481bdb7d3d3df9", "shasum": "" }, "require": { @@ -3652,7 +3655,7 @@ "testing", "xunit" ], - "time": "2018-12-12T07:20:32+00:00" + "time": "2019-02-18T09:24:50+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -3765,23 +3768,23 @@ }, { "name": "sebastian/diff", - "version": "3.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "366541b989927187c4ca70490a35615d3fef2dce" + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/366541b989927187c4ca70490a35615d3fef2dce", - "reference": "366541b989927187c4ca70490a35615d3fef2dce", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", "shasum": "" }, "require": { "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^7.0", + "phpunit/phpunit": "^7.5 || ^8.0", "symfony/process": "^2 || ^3.3 || ^4" }, "type": "library", @@ -3817,32 +3820,35 @@ "unidiff", "unified diff" ], - "time": "2018-06-10T07:54:39+00:00" + "time": "2019-02-04T06:01:07+00:00" }, { "name": "sebastian/environment", - "version": "4.0.1", + "version": "4.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "febd209a219cea7b56ad799b30ebbea34b71eb8f" + "reference": "6fda8ce1974b62b14935adc02a9ed38252eca656" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/febd209a219cea7b56ad799b30ebbea34b71eb8f", - "reference": "febd209a219cea7b56ad799b30ebbea34b71eb8f", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6fda8ce1974b62b14935adc02a9ed38252eca656", + "reference": "6fda8ce1974b62b14935adc02a9ed38252eca656", "shasum": "" }, "require": { "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^7.4" + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -3867,7 +3873,7 @@ "environment", "hhvm" ], - "time": "2018-11-25T09:31:21+00:00" + "time": "2019-02-01T05:27:49+00:00" }, { "name": "sebastian/exporter", diff --git a/config/filesystems.php b/config/filesystems.php index c82285f..462fb45 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -36,12 +36,12 @@ 'work_dir' => [ 'driver' => 'local', - 'root' => getcwd(), + 'root' => work_dir(), ], 'docker' => [ 'driver' => 'local', - 'root' => getcwd() . DIRECTORY_SEPARATOR . '.docker', + 'root' => docker_dir(), ], ], ]; diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php index 547152f..b214480 100755 --- a/tests/CreatesApplication.php +++ b/tests/CreatesApplication.php @@ -13,6 +13,9 @@ trait CreatesApplication */ public function createApplication() { + // Set the ENV of the APP. + putenv('APP_ENV=testing'); + $app = require __DIR__.'/../bootstrap/app.php'; $app->make(Kernel::class)->bootstrap(); diff --git a/tests/Feature/GenerateCommandTest.php b/tests/Feature/GenerateCommandTest.php new file mode 100755 index 0000000..f0d3c9c --- /dev/null +++ b/tests/Feature/GenerateCommandTest.php @@ -0,0 +1,35 @@ +artisan('generate-tools') + ->expectsOutput('containers script generated!') + ->assertExitCode(0); + + $this->assertFileExists(__DIR__ . '/../fixtures/work_dir/containers'); + } + + /** + * Clean up the testing environment before the next test. + * + * @return void + */ + protected function tearDown() + { + parent::tearDown(); + Storage::disk('work_dir')->delete('containers'); + } +} diff --git a/tests/Feature/InitCommandTest.php b/tests/Feature/InitCommandTest.php new file mode 100644 index 0000000..d54d95a --- /dev/null +++ b/tests/Feature/InitCommandTest.php @@ -0,0 +1,26 @@ +artisan('init') + ->expectsQuestion('Enter a name for your project', 'foobar') + ->expectsQuestion('Enter a service name or press enter to quit', 'foo-service') + ->expectsQuestion('Enter a service name or press enter to quit', 'bar-service') + ->expectsQuestion('Enter a service name or press enter to quit', null) + ->expectsOutput('Docker environment created run "docker-compose up -d" within the ".docker" directory!') + ->assertExitCode(0); + } +} diff --git a/tests/Feature/InspiringCommandTest.php b/tests/Feature/InspiringCommandTest.php deleted file mode 100755 index 358e77b..0000000 --- a/tests/Feature/InspiringCommandTest.php +++ /dev/null @@ -1,20 +0,0 @@ -artisan('inspiring') - ->expectsOutput('Simplicity is the ultimate sophistication.') - ->assertExitCode(0); - } -} diff --git a/tests/fixtures/work_dir/.gitignore b/tests/fixtures/work_dir/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/tests/fixtures/work_dir/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore