Download the PHP package erikgall/eloquent-phpunit without Composer

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

Eloquent PHPUnit

StyleCI

Test your Laravel Eloquent model's and database schema

This package was inspired by the Ruby on Rails world and the testing framework RSpec. The Ruby on Rails community (for the most part) write tests for their models in a way that they check the model's attributes, relationships, database table and columns settings (defaults, nullable, etc.).

Table of Contents

  1. What can be tested
  2. Installation
  3. Requirements
  4. Documentation
    1. Properties
    2. Table Testing Methods
    3. Model Testing Methods
  5. Example Model Test Class
  6. Contributing
  7. Version Release History
  8. Projects using Eloquent-PHPUnit
  9. Author
  10. License

What can be tested

You can also test your database tables such as:

Installation

  1. The easiest way to use/install this package is by using composer in your terminal:

  2. Or you can add the following line to your require-dev dependencies in your composer.json file

Requirements

This package requires PHP 5.6 or PHP 7+. It has been tested and used with Laravel 5.2 and Laravel 5.3. There should not be a problem using it with Laravel 5.0/1 but it has not been tested or confirmed 100%.

Documentation

Test Class Properties

Name Type Required Default Description
defaultSeeder string false DatabaseSeeder The database seeder class name that calls the rest of your seeders (only used if seedDatabase property is not set to false).
data array false - Do not overwrite this property. It is used to store the model's data. You can access this data by calling any of the data array's keys like a class property ($this->fillable, $this->casts, $this->table)
model string true - The FQCN of the eloquent model that is to be tested (ex. App\User)
seedDatabase boolean false true Should the database be seeded before each test. If you are not running tests that require data in the database, you should set this to false to speed up your tests.
seeders array false - If you wish to only call certain seeder classes you can set them here (ex. ['UsersTableSeeder', 'PostsTableSeeder'] (only used if seedDatabase property is not set to false).
subject Model** false - This is the instance of the model class that is being tested. When setting up a test, the EloquentTestCase class initializes a new empty model.

*These settings are only used if the seedDatabase property is not set to false (the default value for the seedDatabase property is true).

** The subject property is an instance of \Illuminate\Database\Eloquent\Model.

Database Testing Methods

\EGALL\EloquentPHPUnit\Database\Table

Get the EGALL\EloquentPHPUnit\Database\Table class instance by calling the table property.

Usage:

Table methods


column($columnName)

Initializes a new EGALL\EloquentPHPUnit\Database\Column class instance for table's column name that is passed in.

Usage:

Returns: EGALL\EloquentPHPUnit\Database\Column


exists()

Assert that the table exists in the database.

Usage:

Returns: EGALL\EloquentPHPUnit\Database\Table


hasTimestamps()

Assert that the table has timestamp columns.

Usage:

Returns: EGALL\EloquentPHPUnit\Database\Table


resetTable($tableName)

Using this method it is possible to test multiple tables in one test class.

Usage:

The usage code below is using a user/user-roles, example. The relationship is as follows: A user can have many role and a role can have many users (many-to-many). In eloquent, we would describe this relationship as a user belongsToMany roles through the user_role table and vice-versa.

Returns: EGALL\EloquentPHPUnit\EloquentTestCase / $this


Model Testing Methods

// TODO

Example Model Test

Contributing

  1. Fork it.
  2. Create your branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request.

History

Projects using Eloquent-PHPUnit

Author

License

Eloquent-PHPUnit is an open-sourced software licensed under the MIT license.


All versions of eloquent-phpunit with dependencies

PHP Build Version
Package Version
Requires laravel/framework Version ^5.2|^5.3
doctrine/dbal Version ^2.5
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 erikgall/eloquent-phpunit contains the following files

Loading the files please wait ....