Documentación de Proyecto Sincro

AuthTest extends ApiTestCase

Test unitarios de todas las funciones relacionadas con auth

Tags
see
api
see
controladorUser
requires

PHP 8.0 Uso de tipado estricto y funciones de strings

requires

PHPUnit.

Table of Contents

Properties

$_DEBUG  : bool
$cookieJar  : CookieJar
$http  : Client

Methods

accionesProtegidasProvider()  : array<string|int, mixed>
testAccionesProtegidasSinSesionDevuelven403()  : void
Las acciones protegidas deben devolver 403
testCheckSessionConLoginDevuelveDatosCorrectos()  : void
Si hay login previo, checkSession debe devolver 200
testCheckSessionSinCredencialesDevuelve401()  : void
Si no hay login previo, checkSession debe devolver 401
testLoginCredencialesCorrectasDevuelve200()  : void
Un login correcto debe devolver status 200
testLoginCredencialesIncorrectasDevuelve401()  : void
Un login incorrecto debe devolver 401
testLoginSinCredencialesDevuelve400()  : void
Un login sin credenciales debe ser 400
testLogoutInvalidaSesion()  : void
Se comprueba el ciclo de: iniciar sesion -> checkSession 200 -> cerrar sesion -> checkSession 401
iniciarSesion()  : void
Inicia sesión con las credenciales del .env.
post()  : array{0: int, 1: array}
Ejecuta un POST contra la API y devuelve [statusCode, bodyArray].
setUp()  : void
setUp de los tests. Carga el .env de no estarlo, el cookieJar y http
trace()  : void
Imprime una traza de ejecución con contexto, dirección y payload.

Properties

Methods

accionesProtegidasProvider()

public static accionesProtegidasProvider() : array<string|int, mixed>
Return values
array<string|int, mixed>

testAccionesProtegidasSinSesionDevuelven403()

Las acciones protegidas deben devolver 403

public testAccionesProtegidasSinSesionDevuelven403(string $accion, array<string|int, mixed> $params) : void
Parameters
$accion : string
$params : array<string|int, mixed>
Tags
throws
GuzzleException
Attributes
#[DataProvider]
'accionesProtegidasProvider'

testCheckSessionConLoginDevuelveDatosCorrectos()

Si hay login previo, checkSession debe devolver 200

public testCheckSessionConLoginDevuelveDatosCorrectos() : void
Tags
throws
GuzzleException

testCheckSessionSinCredencialesDevuelve401()

Si no hay login previo, checkSession debe devolver 401

public testCheckSessionSinCredencialesDevuelve401() : void
Tags
throws
GuzzleException

testLoginCredencialesCorrectasDevuelve200()

Un login correcto debe devolver status 200

public testLoginCredencialesCorrectasDevuelve200() : void
Tags
throws
GuzzleException

testLoginCredencialesIncorrectasDevuelve401()

Un login incorrecto debe devolver 401

public testLoginCredencialesIncorrectasDevuelve401() : void
Tags
throws
GuzzleException

testLoginSinCredencialesDevuelve400()

Un login sin credenciales debe ser 400

public testLoginSinCredencialesDevuelve400() : void
Tags
throws
GuzzleException

testLogoutInvalidaSesion()

Se comprueba el ciclo de: iniciar sesion -> checkSession 200 -> cerrar sesion -> checkSession 401

public testLogoutInvalidaSesion() : void
Tags
throws
GuzzleException

iniciarSesion()

Inicia sesión con las credenciales del .env.

protected iniciarSesion([bool $admin = false ]) : void

Marca el test como skipped si no están configuradas.

Parameters
$admin : bool = false
Tags
throws
GuzzleException

post()

Ejecuta un POST contra la API y devuelve [statusCode, bodyArray].

protected post(string $endpoint, array<string|int, mixed> $params) : array{0: int, 1: array}

Imprime automáticamente request y response por consola.

Parameters
$endpoint : string

: Punto de entrada

$params : array<string|int, mixed>

: Parametros de la peticion

Tags
throws
GuzzleException
Return values
array{0: int, 1: array}

setUp()

setUp de los tests. Carga el .env de no estarlo, el cookieJar y http

protected setUp() : void

trace()

Imprime una traza de ejecución con contexto, dirección y payload.

protected trace(string $contexto, string $mensaje[, mixed|null $payload = null ]) : void
Parameters
$contexto : string

: Contexto del mensaje

$mensaje : string

: Mensaje

$payload : mixed|null = null

: Carga del mensaje


        
On this page

Search results