Download the PHP package lucasmelocvl/laravel-model-unit-testing without Composer

On this page you can find all versions of the php package lucasmelocvl/laravel-model-unit-testing. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-model-unit-testing

🛡️ Laravel Model Unit Testing

PHP Version Require Laravel Latest Version on Packagist Total Downloads

Eloquent models are the absolute bedrock of any Laravel application. They represent your business logic, govern data transformations, and guard database integrity. Yet, model configurations are prone to silent, devastating drift:

Writing individual, boiler-plate unit tests for dozens of models is mind-numbing and instantly becomes stale.

laravel-model-unit-testing is a premium, zero-maintenance structural testing suite that shields your Eloquent models from schema drift. By dynamically reflecting your models and checking them directly against your active database schema, it detects structural regressions in milliseconds.


⚡ The Smart-Merge Advantage

Many generators are destructive: they overwrite your test files and wipe out custom test methods you worked hard to build.

Our generator is designed with a Defensive Smart-Merge Engine. When you run the generator with the --force flag:

  1. It parses your existing test file to identify custom test methods and extra PHP use imports.
  2. It regenerates only the structural expectations (like expectedTable(), expectedFillable(), expectedRelationships()).
  3. It safely injects your custom test methods and imports back into the class, completely preserved.

Your custom tests will never be lost.


✨ Key Features


🚀 Installation

You can install the package via Composer (development environment recommended):

The package leverages Laravel package auto-discovery to register the service provider automatically.


📖 Usage

1. Generate Model Tests Automatically

Run the Artisan command to analyze all models and create or merge structural test suites:

This command will:

  1. Discover all Eloquent models in your application.
  2. Scan the database to report any structural inconsistencies or missing tables.
  3. Automatically scaffold premium unit tests in tests/Unit/Models/ matching the subfolder structures of your models.

2. Run the Unit Tests

Execute the tests via PHPUnit:

If memory limits are an issue due to extensive test suites, you can run them with a temporary limit override:


🛠️ How it Works

Generated tests extend the package's robust BaseModelTest abstract class:


🤝 Contributing

We would love to have you help us improve laravel-model-unit-testing! Whether you've found a bug, want to add a feature, or have suggestions for better DB schema mappings, your contributions are highly welcome:

  1. Fork the repository on GitHub.
  2. Clone your fork locally.
  3. Create a descriptive feature branch (git checkout -b feature/cool-new-assertion).
  4. Write high-quality code and include test cases for new behaviors.
  5. Commit your changes and push them to your fork.
  6. Open a Pull Request detailing your changes, the rationale behind them, and how they benefit the community.

Feel free to open an issue on GitHub if you encounter bugs or want to share feedback! Let's build the safest and most robust testing ecosystem for Laravel developers together.


📄 License

This package is open-source software licensed under the MIT License.


All versions of laravel-model-unit-testing with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3|^8.0
illuminate/support Version ^5.8|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
illuminate/console Version ^5.8|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
illuminate/database Version ^5.8|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package lucasmelocvl/laravel-model-unit-testing contains the following files

Loading the files please wait ...