- Notifications
You must be signed in to change notification settings - Fork1
This package provides a trait to run your tests against a MinIO S3 server.
License
protonemedia/laravel-minio-testing-tools
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This package provides a trait to run your tests against a MinIO S3 server.
❤️ We proudly support the community by developing Laravel packages and giving them away for free. If this package saves you time or if you're relying on it professionally, please considersponsoring the maintenance and development and check out our latest premium package:Inertia Table. Keeping track of issues and pull requests takes time, but we're happy to help!
- Starts and configures a MinIO server for your tests.
- Updates the
filesystemsdisk configuration. - Updates and restores the
.envfile. - Works withLaravel Dusk.
- Works onGitHub Actions
- Compatible with Laravel 10.
- PHP 8.2 or higher is required.
Make sure you've downloaded theMinIO Server and Client for your OS.
You can install the package via composer:
composer require protonemedia/laravel-minio-testing-tools --dev
Add the trait to your test, and add thebootUsesMinIOServer method:
<?phpnamespaceTests\Browser;useIlluminate\Foundation\Testing\DatabaseMigrations;useProtoneMedia\LaravelMinioTestingTools\UsesMinIOServer;useTests\DuskTestCase;class UploadVideoTestextends DuskTestCase{use DatabaseMigrations;use UsesMinIOServer;protectedfunctionsetUp():void {parent::setUp();$this->bootUsesMinIOServer(); }/** @test */publicfunctionit_can_upload_a_video_using_multipart_upload() { }}
That's it!
The easiest way is to download the MinIO Server and Client before the tests are run:
jobs:test:steps: -uses:actions/checkout@v2 -name:Download MinIO S3 server and clientrun:| wget https://dl.minio.io/server/minio/release/linux-amd64/minio -q -P /usr/local/bin/ wget https://dl.minio.io/client/mc/release/linux-amd64/mc -q -P /usr/local/bin/ chmod +x /usr/local/bin/minio chmod +x /usr/local/bin/mc minio --version mc --version
If you're usingphp artisan serve, make sure you don't use the--no-reload flag, as the.env file will be changed on-the-fly.
Optionally, if you want persistent storage across the test suite, you may start the server manually before the tests are run.
jobs:test:steps: -uses:actions/checkout@v2 -name:Download MinIO S3 server and clientrun:| wget https://dl.minio.io/server/minio/release/linux-amd64/minio -q -P /usr/local/bin/ wget https://dl.minio.io/client/mc/release/linux-amd64/mc -q -P /usr/local/bin/ chmod +x /usr/local/bin/minio chmod +x /usr/local/bin/mc minio --version mc --version -name:Run MinIO S3 serverrun:| mkdir ~/s3 sudo minio server ~/s3 --json > minio-log.json & -name:Configure MinIO S3run:| mc config host add local http://127.0.0.1:9000 minioadmin minioadmin mc admin user add local user password mc admin policy set local readwrite user=user mc mb local/bucket-name --region=eu-west-1 -name:Upload Minio Logs (optional)if:failure()uses:actions/upload-artifact@v2with:name:miniopath:minio-log.json
In this case, you also need to supply an environment file with the MinIO configuration. This makes the configuration also accessible by the browser session when you're running Laravel Dusk.
AWS_ACCESS_KEY_ID=userAWS_SECRET_ACCESS_KEY=passwordAWS_DEFAULT_REGION=eu-west-1AWS_BUCKET=bucket-nameAWS_URL=http://127.0.0.1:9000AWS_ENDPOINT=http://127.0.0.1:9000AWS_USE_PATH_STYLE_ENDPOINT=true
composertestPlease seeCHANGELOG for more information on what has changed recently.
Please seeCONTRIBUTING for details.
Inertia Table: The Ultimate Table for Inertia.js with built-in Query Builder.Laravel Blade On Demand: Laravel package to compile Blade templates in memory.Laravel Cross Eloquent Search: Laravel package to search through multiple Eloquent models.Laravel Eloquent Scope as Select: Stop duplicating your Eloquent query scopes and constraints in PHP. This package lets you re-use your query scopes and constraints by adding them as a subquery.Laravel FFMpeg: This package provides an integration with FFmpeg for Laravel. The storage of the files is handled by Laravel's Filesystem.Laravel MinIO Testing Tools: Run your tests against a MinIO S3 server.Laravel Mixins: A collection of Laravel goodies.Laravel Paddle: Paddle.com API integration for Laravel with support for webhooks/events.Laravel Task Runner: Write Shell scripts like Blade Components and run them locally or on a remote server.Laravel Verify New Email: This package adds support for verifying new email addresses: when a user updates its email address, it won't replace the old one until the new one is verified.Laravel XSS Protection: Laravel Middleware to protect your app against Cross-site scripting (XSS). It sanitizes request input, and it can sanatize Blade echo statements.
If you discover any security-related issues, please emailcode@protone.media instead of using the issue tracker. Please do not email any questions, open an issue if you have a question.
The MIT License (MIT). Please seeLicense File for more information.
About
This package provides a trait to run your tests against a MinIO S3 server.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.
Contributors4
Uh oh!
There was an error while loading.Please reload this page.
