Download the PHP package thomasdominic/eloquent-model-testor without Composer

On this page you can find all versions of the php package thomasdominic/eloquent-model-testor. 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 eloquent-model-testor

Helper for Testing structures, relations of your models in Laravel

Latest Version on Packagist StyleCI Build Status Quality Score Total Downloads

This package allows you to test your models about table structures, relations and more

Installation

You can install the package via composer:

Usage

To use this package, you have to generate factories for your models. (See Factories Documentation) You can generate one test file by model or for several. For your model MyModel you can use this command for example:

Test of structure and of fillable

With this structure

users
    id - integer
    name - string
    other_field - string 

you can test if you have all the fields you need and if they are fillable.

HasMany et BelongsTo

You can test relations of your models. For example, with this structure

categories
    id - integer
    name - string

customers
    id - integer
    name - string
    category_id - integer
    type_id - integer

you can use assertHasHasManyRelations and assertHasBelongsToRelations methods like this

If you don't use Laravel naming convention, you may also override the relation and local keys (for belongsTo relation) by passing additional arguments to the assertHasHasManyRelations and assertHasBelongsToRelations methods

If you have several relations, you can chain methods like this:

Many to Many relations

You can test your ManyToMany relations with the ManyToManyRelationsTestable trait.

users
    id - integer
    name - string

roles
    id - integer
    name - string

role_user
    user_id - integer
    role_id - integer

You can override the relation argument too :

Morph Relations

If you have a Morph Relation,

posts
    id - integer
    title - string
    body - text

videos
    id - integer
    title - string
    url - string

comments
    id - integer
    body - text
    commentable_id - integer
    commentable_type - string

you can use assertHasBelongsToMorphRelations and assertHasHasManyMorphRelations methods like this

Pivot and table without Model

You can test if a table contains columns with the tableTestable method

Testing

Changelog

Please see CHANGELOG for more information about what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.


All versions of eloquent-model-testor with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4
illuminate/support Version ^6.0|^7.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 thomasdominic/eloquent-model-testor contains the following files

Loading the files please wait ....