hivokas /
laravel-handlers
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Hivokas\LaravelHandlers\Tests; |
||
| 4 | |||
| 5 | use Illuminate\Filesystem\Filesystem; |
||
| 6 | use Orchestra\Testbench\TestCase as OrchestraTestCase; |
||
| 7 | use Hivokas\LaravelHandlers\Providers\HandlersServiceProvider; |
||
| 8 | |||
| 9 | abstract class AbstractTestCase extends OrchestraTestCase |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var Filesystem |
||
| 13 | */ |
||
| 14 | protected $files; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Define environment setup. |
||
| 18 | * |
||
| 19 | * @param \Illuminate\Foundation\Application $app |
||
| 20 | * |
||
| 21 | * @return void |
||
| 22 | */ |
||
| 23 | protected function getEnvironmentSetUp($app) |
||
| 24 | { |
||
| 25 | $this->files = new Filesystem(); |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Get package providers. |
||
| 30 | * |
||
| 31 | * @param \Illuminate\Foundation\Application $app |
||
| 32 | * @return array |
||
| 33 | */ |
||
| 34 | protected function getPackageProviders($app) |
||
|
0 ignored issues
–
show
|
|||
| 35 | { |
||
| 36 | return [ |
||
| 37 | HandlersServiceProvider::class, |
||
| 38 | ]; |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Make the directory. |
||
| 43 | * |
||
| 44 | * @param string $path |
||
| 45 | * @return string |
||
| 46 | */ |
||
| 47 | protected function makeDirectory(string $path): string |
||
| 48 | { |
||
| 49 | if (! $this->files->isDirectory(dirname($path))) { |
||
| 50 | $this->files->makeDirectory(dirname($path), 0777, true, true); |
||
| 51 | } |
||
| 52 | |||
| 53 | return $path; |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * Put contents to file. |
||
| 58 | * |
||
| 59 | * @param string $path |
||
| 60 | * @param string $contents |
||
| 61 | * @param bool $lock |
||
| 62 | */ |
||
| 63 | protected function forceFilePutContents(string $path, string $contents, bool $lock = false): void |
||
| 64 | { |
||
| 65 | $this->makeDirectory($path); |
||
| 66 | $this->files->put($path, $contents, $lock); |
||
| 67 | } |
||
| 68 | } |
||
| 69 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.