Download the PHP package emeset/test without Composer

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

emeset/test

Eines de testing per a projectes basats en el microframework docent Emeset.

L’objectiu del paquet és que, en un projecte Emeset, puguis escriure tests així de senzills:

i tenir automàticament disponible:


Instal·lació

Al teu projecte Emeset (per exemple, el projecte links o el projecte de sessió/login), executa:

Això instal·larà:


Configuració bàsica del projecte

El paquet NO crea fitxers al teu projecte ni genera res automàticament.
Tu decideixes on van les coses. Et proposo la següent estructura:

1. Fitxer phpunit.xml a l’arrel del projecte

Crea un fitxer phpunit.xml amb aquest contingut mínim:

2. Fitxer tests/bootstrap.php

Crea el fitxer tests/bootstrap.php:

3. Afegir un script de test a composer.json (opcional però recomanat)

Al composer.json del teu projecte pots afegir:

A partir d’ara, podràs executar els tests amb:


Escriure el primer test (SmokeTest)

Crea la carpeta tests/ i dins un fitxer tests/SmokeTest.php:

Executa:

Si tot està bé, veuràs que tens 1 test OK.
A partir d’aquí ja pots fer servir la Emeset\Test\TestCase per provar el teu codi Emeset.


Classe base Emeset\Test\TestCase

Quan vulguis fer tests del teu codi Emeset (controladors, middlewares, models…), fes servir la classe base del paquet:

Què fa aquesta TestCase per tu?

A cada test:


Recursos d’exemple al paquet

Dins el paquet emeset/test trobaràs una carpeta resources/ amb exemples:

ExamplePortadaControllerTest.php (resum)

Exemple de test d’un controlador que carrega una vista:

ExamplePortadaRutaTest.php (resum)

Exemple de test d’una ruta:

Emeset/test també permet fer testos de rutes, aquest són testos d'integració. Per poder-ho fer cal fer un petit canvi a l'index.php Caldrà copiar les rutes a un fitxer rutes.php que crearem a la carpeta App/. Així a l'index.php passarem de:

a

I al fitxer App\routes.php

Aquest canvi permetra que el testCase també pugui inicialtizar les rutes per als testos.

I podrem fer testos com aquest.

El test case té tres mètodes per fer testos de rutes:


Flux de treball recomanat

  1. Instal·lar el paquet al projecte Emeset:

  2. Crear phpunit.xml i tests/bootstrap.php a partir de les plantilles.

  3. Afegir un primer SmokeTest senzill.

  4. Crear un test de controlador que no toqui base de dades (per exemple, Portada).

  5. Quan això funcioni, passar al tutorial de FirstStepsUnitTesting.md per provar controladors que sí que treballen amb BD.

On seguir


All versions of test with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
emeset/framework Version ^0.4
phpunit/phpunit Version ^12.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 emeset/test contains the following files

Loading the files please wait ...