Download the PHP package skrepr/dto-tester without Composer

On this page you can find all versions of the php package skrepr/dto-tester. 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 dto-tester

skrepr

Data Transfer Object - Tester

This is a simple library to make unit tests for DTO's and Entity objects easier. By using this DtoTestCase it will automatically test all public properties and get/set combinations.

Of course this is not just to satisfy the "coverage", but it is to test the basics and makes sure that your DTO's are always behave the same as you expect.

Note that you always must create your own extra tests for specific tasks and any business logic.

Installation

You can install the package using the Composer package manager. It is recommended that you install this only as a development package. You can install it by running this command in your project root:

Usage

The abstract class DtoTestCase has 3 required methods for you to implement:

And at this moment one optional setting:

The getInstance method should return a testable object. This object is only requested twice during all the tests. First for the properties and the second time when the methods are tested.

Next the getTestValuesForProperty and getTestValuesForMethod methods should return an array with possible values that should be tested.

The getTestValuesForProperty method gets the property name and type, here you can check and give values you want to test. You can also give a null value instead of an array, then the tests for that property are skipped (unless it is a nullable-property). The nullable variant will always be tested, it is not possible to use null as a value within the array.

The getTestValuesForMethod method works in the same way, it only gives back the method name extra.

For union types, the property/parameter will be tested for every type in the union.

When you don't have special needs, you can use "match" like this:

It is not recommended to use a "default" when using a match like this. In fact, you will get a nice readable exception, so you know what you missed.

Known issues


All versions of dto-tester with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
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 skrepr/dto-tester contains the following files

Loading the files please wait ....