Download the PHP package package-for-laravel/testing-framework without Composer

On this page you can find all versions of the php package package-for-laravel/testing-framework. 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 testing-framework

Laravel Test Framework

This library adds in test utilities and a useful framework for Laravel projects.

Installation

Requirements

Install using composer:

composer require --dev package-for-laravel/testing-framework

Features

Unit Test Cases

This project sets up a three-stage or level testing framework:

When you set up your tests directory, you may make three folders named after those types. Then, you can extend a Test Case named after each.

For example, you may have the file tests/Unit/Models/User.php that looks like this:

These test cases expect you still have the default Laravel Framework testing setup. Specifically, they will extend Tests\TestCase from your own application. (This most likely creates the application anyway so you probably have it.)

Features for all Tests

The todo() method will mark the test as incomplete. So, if you want to come back to it later, you can do so. This is nice because sometimes you know what you want to test at the time, but you might not be able to do so. For example:

This way, you won't forget to test the full name later. But, your tests will still execute properly.

Features of Unit Test Case

With Unit Test Case, an exception is thrown if a test accessed the database during execution.

Features of Integration Test Case

Integration test case will run the database migrations from RefreshDatabase, which sets up the transactions. It will also call all your seeders.

Features of Feature Test Case

The features test case includes a createActingAs() method. This allows you to pass in properties that will be passed over to your User model factory. When the user is created, it will be saved to the database, then also added to a protected property $this->actingAs and returned as well. By default, it will create the user model you have set in your config. You can override this with the second parameter, though.

Next, it features the method noAuthRedirectTest() which takes a url. This will validate that the user is redirected if they are not authenticated.

You can also specify the method of http request as the second parameter. By default, the redirect to is a route named login but you can override this as the third parameter.

Deep Inspection

Very rarely should you need to do deep inspection of your methods and properties in your unit testing. However, sometimes it becomes so hard to develop a complex mocking system (or a collection of final classes make it impossible to) that it requires you to call and access non-public properties and methods. While this is not recommended (and if you find yourself using this functionality often, you should consider it a code smell), you can do so with the following functionality:

First, register the global helpers in your PHPUnit bootstrap. You can do so like this:

Now, you will have the following functionality:

callMethod() which calls a method deeply on a class and returns the value.

For example:

getProperty() is basically the same functionality, but to get a property.

Testing

Where are your tests? That's kind of a circular reference - testing a testing framework right? But alas, there are none right now.

Credits

This package is created and maintained by Aaron Saray


All versions of testing-framework with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3
phpunit/phpunit Version ^8
laravel/framework Version ^5.8|^6|^7
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 package-for-laravel/testing-framework contains the following files

Loading the files please wait ....