diff --git a/.github/lang/es-ES/README.md b/.github/lang/es-ES/README.md index 08d62b6..e322da1 100644 --- a/.github/lang/es-ES/README.md +++ b/.github/lang/es-ES/README.md @@ -33,7 +33,9 @@ Biblioteca PHP para manejo de sesiones. ## Requisitos -Esta biblioteca es compatible con las versiones de PHP: 8.0 | 8.1. +- Sistema operativo: Linux | Windows. + +- Versiones de PHP: 8.0 | 8.1 | 8.2 | 8.3. ## Instalación @@ -58,19 +60,11 @@ También puedes **clonar el repositorio** completo con Git: git clone https://github.com/josantonius/php-session.git ``` -## Métodos disponibles - -### Session Class - -```php -use Josantonius\Session\Session; -``` +## Clases disponibles -Create object: +### Clase Session -```php -$session = new Session(); -``` +`Josantonius\Session\Session` Iniciar la sesión: @@ -82,13 +76,13 @@ Iniciar la sesión: * * @see https://php.net/session.configuration para ver la lista de opciones disponibles. */ -$session->start(array $options = []): bool +public function start(array $options = []): bool; ``` Comprobar si la sesión fue iniciada: ```php -$session->isStarted(): bool +public function isStarted(): bool; ``` Establecer un atributo por su nombre: @@ -97,7 +91,7 @@ Establecer un atributo por su nombre: /** * @throws SessionNotStartedException si la sesión no está iniciada. */ -$session->set(string $name, mixed $value): void +public function set(string $name, mixed $value): void; ``` Obtener un atributo por su nombre: @@ -106,19 +100,19 @@ Obtener un atributo por su nombre: /** * Opcionalmente define un valor por defecto cuando el atributo no existe. */ -$session->get(string $name, mixed $default = null): mixed +public function get(string $name, mixed $default = null): mixed; ``` Obtener todos los atributos: ```php -$session->all(): array +public function all(): array; ``` Comprobar si un atributo existe en la sesión: ```php -$session->has(string $name): bool +public function has(string $name): bool; ``` Establecer múltiples atributos de una vez: @@ -129,7 +123,7 @@ Establecer múltiples atributos de una vez: * * @throws SessionNotStartedException si la sesión no está iniciada. */ -$session->replace(array $data): void +public function replace(array $data): void; ``` Eliminar un atributo por su nombre y devolver su valor: @@ -140,7 +134,7 @@ Eliminar un atributo por su nombre y devolver su valor: * * @throws SessionNotStartedException si la sesión no está iniciada. */ -$session->pull(string $name, mixed $default = null): mixed +public function pull(string $name, mixed $default = null): mixed; ``` Eliminar un atributo por su nombre: @@ -149,7 +143,7 @@ Eliminar un atributo por su nombre: /** * @throws SessionNotStartedException si la sesión no está iniciada. */ -$session->remove(string $name): void +public function remove(string $name): void; ``` Liberar todas las variables de la sesión: @@ -158,13 +152,13 @@ Liberar todas las variables de la sesión: /** * @throws SessionNotStartedException si la sesión no está iniciada. */ -$session->clear(): void +public function clear(): void; ``` Obtiene el ID de la sesión: ```php -$session->getId(): string +public function getId(): string; ``` Establecer el ID de la sesión: @@ -173,7 +167,7 @@ Establecer el ID de la sesión: /** * @throws SessionStartedException si la sesión ya está iniciada. */ -$session->setId(string $sessionId): void +public function setId(string $sessionId): void; ``` Actualizar el ID de la sesión actual con uno recién generado: @@ -182,13 +176,13 @@ Actualizar el ID de la sesión actual con uno recién generado: /** * @throws SessionNotStartedException si la sesión no está iniciada. */ -$session->regenerateId(bool $deleteOldSession = false): bool +public function regenerateId(bool $deleteOldSession = false): bool; ``` Obtener el nombre de la sesión: ```php -$session->getName(): string +public function getName(): string; ``` Establecer el nombre de la sesión: @@ -197,7 +191,7 @@ Establecer el nombre de la sesión: /** * @throws SessionStartedException si la sesión ya está iniciada. */ -$session->setName(string $name): void +public function setName(string $name): void; ``` Eliminar la sesión: @@ -206,14 +200,12 @@ Eliminar la sesión: /** * @throws SessionNotStartedException si la sesión no está iniciada. */ -$session->destroy(): bool +public function destroy(): bool; ``` ### Fachada Session -```php -use Josantonius\Session\Facades\Session; -``` +`Josantonius\Session\Facades\Session` Iniciar la sesión: @@ -225,13 +217,13 @@ Iniciar la sesión: * * @see https://php.net/session.configuration para ver la lista de opciones disponibles. */ -Session::start(array $options = []): bool +public static function start(array $options = []): bool; ``` Comprobar si la sesión fue iniciada: ```php -Session::isStarted(): bool +public static function isStarted(): bool; ``` Establecer un atributo por su nombre: @@ -240,7 +232,7 @@ Establecer un atributo por su nombre: /** * @throws SessionNotStartedException si la sesión no está iniciada. */ -Session::set(string $name, mixed $value): void +public static function set(string $name, mixed $value): void; ``` Obtener un atributo por su nombre: @@ -249,19 +241,19 @@ Obtener un atributo por su nombre: /** * Opcionalmente define un valor por defecto cuando el atributo no existe. */ -Session::get(string $name, mixed $default = null): mixed +public static function get(string $name, mixed $default = null): mixed; ``` Obtener todos los atributos: ```php -Session::all(): array +public static function all(): array; ``` Comprobar si un atributo existe en la sesión: ```php -Session::has(string $name): bool +public static function has(string $name): bool; ``` Establecer múltiples atributos de una vez: @@ -272,7 +264,7 @@ Establecer múltiples atributos de una vez: * * @throws SessionNotStartedException si la sesión no está iniciada. */ -Session::replace(array $data): void +public static function replace(array $data): void; ``` Eliminar un atributo por su nombre y devolver su valor: @@ -283,7 +275,7 @@ Eliminar un atributo por su nombre y devolver su valor: * * @throws SessionNotStartedException si la sesión no está iniciada. */ -Session::pull(string $name, mixed $default = null): mixed +public static function pull(string $name, mixed $default = null): mixed; ``` Eliminar un atributo por su nombre: @@ -292,7 +284,7 @@ Eliminar un atributo por su nombre: /** * @throws SessionNotStartedException si la sesión no está iniciada. */ -Session::remove(string $name): void +public static function remove(string $name): void; ``` Liberar todas las variables de la sesión: @@ -301,13 +293,13 @@ Liberar todas las variables de la sesión: /** * @throws SessionNotStartedException si la sesión no está iniciada. */ -Session::clear(): void +public static function clear(): void; ``` Obtiene el ID de la sesión: ```php -Session::getId(): string +public static function getId(): string; ``` Establecer el ID de la sesión: @@ -316,7 +308,7 @@ Establecer el ID de la sesión: /** * @throws SessionStartedException si la sesión ya está iniciada. */ -Session::setId(string $sessionId): void +public static function setId(string $sessionId): void; ``` Actualizar el ID de la sesión actual con uno recién generado: @@ -325,13 +317,13 @@ Actualizar el ID de la sesión actual con uno recién generado: /** * @throws SessionNotStartedException si la sesión no está iniciada. */ -Session::regenerateId(bool $deleteOldSession = false): bool +public static function regenerateId(bool $deleteOldSession = false): bool; ``` Obtener el nombre de la sesión: ```php -Session::getName(): string +public static function getName(): string; ``` Establecer el nombre de la sesión: @@ -340,7 +332,7 @@ Establecer el nombre de la sesión: /** * @throws SessionStartedException si la sesión ya está iniciada. */ -Session::setName(string $name): void +public static function setName(string $name): void; ``` Eliminar la sesión: @@ -349,7 +341,7 @@ Eliminar la sesión: /** * @throws SessionNotStartedException si la sesión no está iniciada. */ -Session::destroy(): bool +public static function destroy(): bool; ``` ## Excepciones utilizadas @@ -362,7 +354,7 @@ use Josantonius\Session\Exceptions\SessionStartedException; use Josantonius\Session\Exceptions\WrongSessionOptionException; ``` -## Usage +## Uso Ejemplos de uso para esta biblioteca: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93e8597..1318904 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: - name: 'Setup PHP' uses: 'shivammathur/setup-php@v2' with: - php-version: '8.1' + php-version: '8.3' coverage: 'none' tools: 'composer:v2, composer-normalize' @@ -43,10 +43,12 @@ jobs: name: 'PHPUnit (PHP ${{ matrix.php }} - ${{ matrix.system }})' strategy: matrix: - system: ['ubuntu-latest'] + system: ['ubuntu-latest', 'windows-latest'] php: - '8.0' - '8.1' + - '8.2' + - '8.3' steps: - name: Checkout Code uses: actions/checkout@v3 @@ -76,7 +78,7 @@ jobs: - name: 'Setup PHP' uses: 'shivammathur/setup-php@v2' with: - php-version: '8.1' + php-version: '8.3' tools: 'composer:v2' - name: 'Install dependencies' diff --git a/CHANGELOG.md b/CHANGELOG.md index 227efdb..1180163 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # CHANGELOG +## [v2.0.9](https://github.com/josantonius/php-session/releases/tag/v2.0.9) (2024-05-20) + +* Tests for PHP 8.3 have been added. + +## [v2.0.8](https://github.com/josantonius/php-session/releases/tag/v2.0.8) (2022-09-29) + +* The notation type in the test function names has been changed from camel to snake case for readability. + +* Functions were added to document the methods and avoid confusion. + +* Disabled the ´CamelCaseMethodName´ rule in ´phpmd.xml´ to avoid warnings about function names in tests. + +* The alignment of the asterisks in the comments has been fixed. + +* Tests for Windows have been added. + +* Tests for PHP 8.2 have been added. + ## [v2.0.7](https://github.com/josantonius/php-session/releases/tag/v2.0.7) (2022-08-11) * Improved documentation. diff --git a/README.md b/README.md index 9bb7035..fbc47cd 100644 --- a/README.md +++ b/README.md @@ -26,14 +26,16 @@ PHP library for handling sessions. - [TODO](#todo) - [Changelog](#changelog) - [Contribution](#contribution) -- [Sponsor](#Sponsor) +- [Sponsor](#sponsor) - [License](#license) --- ## Requirements -This library is compatible with the PHP versions: 8.0 | 8.1. +- Operating System: Linux | Windows. + +- PHP versions: 8.0 | 8.1 | 8.2 | 8.3. ## Installation @@ -62,15 +64,7 @@ git clone https://github.com/josantonius/php-session.git ### Session Class -```php -use Josantonius\Session\Session; -``` - -Create object: - -```php -$session = new Session(); -``` +`Josantonius\Session\Session` Starts the session: @@ -82,13 +76,13 @@ Starts the session: * * @see https://php.net/session.configuration for List of available $options. */ -$session->start(array $options = []): bool +public function start(array $options = []): bool; ``` Check if the session is started: ```php -$session->isStarted(): bool +public function isStarted(): bool; ``` Sets an attribute by name: @@ -97,7 +91,7 @@ Sets an attribute by name: /** * @throws SessionNotStartedException if session was not started. */ -$session->set(string $name, mixed $value): void +public function set(string $name, mixed $value): void; ``` Gets an attribute by name: @@ -106,19 +100,19 @@ Gets an attribute by name: /** * Optionally defines a default value when the attribute does not exist. */ -$session->get(string $name, mixed $default = null): mixed +public function get(string $name, mixed $default = null): mixed; ``` Gets all attributes: ```php -$session->all(): array +public function all(): array; ``` Check if an attribute exists in the session: ```php -$session->has(string $name): bool +public function has(string $name): bool; ``` Sets several attributes at once: @@ -129,7 +123,7 @@ Sets several attributes at once: * * @throws SessionNotStartedException if session was not started. */ -$session->replace(array $data): void +public function replace(array $data): void; ``` Deletes an attribute by name and returns its value: @@ -140,7 +134,7 @@ Deletes an attribute by name and returns its value: * * @throws SessionNotStartedException if session was not started. */ -$session->pull(string $name, mixed $default = null): mixed +public function pull(string $name, mixed $default = null): mixed; ``` Deletes an attribute by name: @@ -149,7 +143,7 @@ Deletes an attribute by name: /** * @throws SessionNotStartedException if session was not started. */ -$session->remove(string $name): void +public function remove(string $name): void; ``` Free all session variables: @@ -158,13 +152,13 @@ Free all session variables: /** * @throws SessionNotStartedException if session was not started. */ -$session->clear(): void +public function clear(): void; ``` Gets the session ID: ```php -$session->getId(): string +public function getId(): string; ``` Sets the session ID: @@ -173,7 +167,7 @@ Sets the session ID: /** * @throws SessionStartedException if session already started. */ -$session->setId(string $sessionId): void +public function setId(string $sessionId): void; ``` Update the current session ID with a newly generated one: @@ -182,13 +176,13 @@ Update the current session ID with a newly generated one: /** * @throws SessionNotStartedException if session was not started. */ -$session->regenerateId(bool $deleteOldSession = false): bool +public function regenerateId(bool $deleteOldSession = false): bool; ``` Gets the session name: ```php -$session->getName(): string +public function getName(): string; ``` Sets the session name: @@ -197,7 +191,7 @@ Sets the session name: /** * @throws SessionStartedException if session already started. */ -$session->setName(string $name): void +public function setName(string $name): void; ``` Destroys the session: @@ -206,14 +200,12 @@ Destroys the session: /** * @throws SessionNotStartedException if session was not started. */ -$session->destroy(): bool +public function destroy(): bool; ``` ### Session Facade -```php -use Josantonius\Session\Facades\Session; -``` +`Josantonius\Session\Facades\Session` Starts the session: @@ -225,13 +217,13 @@ Starts the session: * * @see https://php.net/session.configuration for List of available $options. */ -Session::start(array $options = []): bool +public static function start(array $options = []): bool; ``` Check if the session is started: ```php -Session::isStarted(): bool +public static function isStarted(): bool; ``` Sets an attribute by name: @@ -240,7 +232,7 @@ Sets an attribute by name: /** * @throws SessionNotStartedException if session was not started. */ -Session::set(string $name, mixed $value): void +public static function set(string $name, mixed $value): void; ``` Gets an attribute by name: @@ -249,19 +241,19 @@ Gets an attribute by name: /** * Optionally defines a default value when the attribute does not exist. */ -Session::get(string $name, mixed $default = null): mixed +public static function get(string $name, mixed $default = null): mixed; ``` Gets all attributes: ```php -Session::all(): array +public static function all(): array; ``` Check if an attribute exists in the session: ```php -Session::has(string $name): bool +public static function has(string $name): bool; ``` Sets several attributes at once: @@ -272,7 +264,7 @@ Sets several attributes at once: * * @throws SessionNotStartedException if session was not started. */ -Session::replace(array $data): void +public static function replace(array $data): void; ``` Deletes an attribute by name and returns its value: @@ -283,7 +275,7 @@ Deletes an attribute by name and returns its value: * * @throws SessionNotStartedException if session was not started. */ -Session::pull(string $name, mixed $default = null): mixed +public static function pull(string $name, mixed $default = null): mixed; ``` Deletes an attribute by name: @@ -292,7 +284,7 @@ Deletes an attribute by name: /** * @throws SessionNotStartedException if session was not started. */ -Session::remove(string $name): void +public static function remove(string $name): void; ``` Free all session variables: @@ -301,13 +293,13 @@ Free all session variables: /** * @throws SessionNotStartedException if session was not started. */ -Session::clear(): void +public static function clear(): void; ``` Gets the session ID: ```php -Session::getId(): string +public static function getId(): string; ``` Sets the session ID: @@ -316,7 +308,7 @@ Sets the session ID: /** * @throws SessionStartedException if session already started. */ -Session::setId(string $sessionId): void +public static function setId(string $sessionId): void; ``` Update the current session ID with a newly generated one: @@ -325,13 +317,13 @@ Update the current session ID with a newly generated one: /** * @throws SessionNotStartedException if session was not started. */ -Session::regenerateId(bool $deleteOldSession = false): bool +public static function regenerateId(bool $deleteOldSession = false): bool; ``` Gets the session name: ```php -Session::getName(): string +public static function getName(): string; ``` Sets the session name: @@ -340,7 +332,7 @@ Sets the session name: /** * @throws SessionStartedException if session already started. */ -Session::setName(string $name): void +public static function setName(string $name): void; ``` Destroys the session: @@ -349,7 +341,7 @@ Destroys the session: /** * @throws SessionNotStartedException if session was not started. */ -Session::destroy(): bool +public static function destroy(): bool; ``` ## Exceptions Used diff --git a/composer.json b/composer.json index f25482e..084abb6 100644 --- a/composer.json +++ b/composer.json @@ -55,7 +55,7 @@ "htmlCoverage": "vendor/bin/phpunit --coverage-html coverage", "phpcs": "vendor/bin/phpcs --standard=phpcs.xml $(find . -name '*.php');", "phpmd": "vendor/bin/phpmd src,tests text ./phpmd.xml", - "phpunit": "vendor/bin/phpunit --colors=always;", + "phpunit": "vendor/bin/phpunit", "tests": [ "clear", "@phpmd", diff --git a/phpmd.xml b/phpmd.xml index fdea465..899a33d 100644 --- a/phpmd.xml +++ b/phpmd.xml @@ -32,7 +32,7 @@ - + diff --git a/tests/AllMethodTest.php b/tests/AllMethodTest.php index 1de1a21..e4fd043 100644 --- a/tests/AllMethodTest.php +++ b/tests/AllMethodTest.php @@ -7,6 +7,8 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * + * @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps */ namespace Josantonius\Session\Tests; @@ -29,7 +31,7 @@ public function setUp(): void /** * @runInSeparateProcess */ - public function testShouldGetAllAttributes(): void + public function test_should_get_all_attributes(): void { $this->session->start(); @@ -41,7 +43,7 @@ public function testShouldGetAllAttributes(): void /** * @runInSeparateProcess */ - public function testShouldGetAllAttributesDefinedOutsideLibrary(): void + public function test_should_get_all_attributes_defined_outside_library(): void { session_start(); @@ -53,7 +55,7 @@ public function testShouldGetAllAttributesDefinedOutsideLibrary(): void /** * @runInSeparateProcess */ - public function testShouldReturnEmptyArrayWhenUnstartedSession(): void + public function test_should_return_empty_array_when_unstarted_session(): void { $this->assertIsArray($this->session->all()); } @@ -61,7 +63,7 @@ public function testShouldReturnEmptyArrayWhenUnstartedSession(): void /** * @runInSeparateProcess */ - public function testShouldBeAvailableFromTheFacade(): void + public function test_should_be_available_from_the_facade(): void { $facade = new SessionFacade(); diff --git a/tests/ClearMethodTest.php b/tests/ClearMethodTest.php index dcee1ac..eb837f6 100644 --- a/tests/ClearMethodTest.php +++ b/tests/ClearMethodTest.php @@ -7,6 +7,8 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * + * @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps */ namespace Josantonius\Session\Tests; @@ -30,7 +32,7 @@ public function setUp(): void /** * @runInSeparateProcess */ - public function testShouldClearSession(): void + public function test_should_clear_session(): void { $this->session->start(); @@ -44,7 +46,7 @@ public function testShouldClearSession(): void /** * @runInSeparateProcess */ - public function testShouldClearSessionWhenNativeSessionWasStarted(): void + public function test_should_clear_session_when_native_session_was_started(): void { session_start(); @@ -58,7 +60,7 @@ public function testShouldClearSessionWhenNativeSessionWasStarted(): void /** * @runInSeparateProcess */ - public function testShouldFailIfSessionIsUnstarted(): void + public function test_should_fail_if_session_is_unstarted(): void { $this->expectException(SessionNotStartedException::class); @@ -68,7 +70,7 @@ public function testShouldFailIfSessionIsUnstarted(): void /** * @runInSeparateProcess */ - public function testShouldBeAvailableFromTheFacade(): void + public function test_should_be_available_from_the_facade(): void { $facade = new SessionFacade(); diff --git a/tests/DestroyMethodTest.php b/tests/DestroyMethodTest.php index 272c6f4..bdd5f5a 100644 --- a/tests/DestroyMethodTest.php +++ b/tests/DestroyMethodTest.php @@ -7,6 +7,8 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * + * @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps */ namespace Josantonius\Session\Tests; @@ -30,7 +32,7 @@ public function setUp(): void /** * @runInSeparateProcess */ - public function testShouldDestroySession(): void + public function test_should_destroy_session(): void { $this->session->start(); @@ -44,7 +46,7 @@ public function testShouldDestroySession(): void /** * @runInSeparateProcess */ - public function testShouldDestroySessionWhenNativeSessionWasStarted(): void + public function test_should_destroy_session_when_native_session_was_started(): void { session_start(); @@ -58,7 +60,7 @@ public function testShouldDestroySessionWhenNativeSessionWasStarted(): void /** * @runInSeparateProcess */ - public function testShouldFailIfSessionIsUnstarted(): void + public function test_should_fail_if_session_is_unstarted(): void { $this->expectException(SessionNotStartedException::class); @@ -68,7 +70,7 @@ public function testShouldFailIfSessionIsUnstarted(): void /** * @runInSeparateProcess */ - public function testShouldBeAvailableFromTheFacade(): void + public function test_should_be_available_from_the_facade(): void { $facade = new SessionFacade(); diff --git a/tests/GetIdMethodTest.php b/tests/GetIdMethodTest.php index 73a2e19..9de0e0b 100644 --- a/tests/GetIdMethodTest.php +++ b/tests/GetIdMethodTest.php @@ -7,6 +7,8 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * + * @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps */ namespace Josantonius\Session\Tests; @@ -29,7 +31,7 @@ public function setUp(): void /** * @runInSeparateProcess */ - public function testShouldGetSessionId(): void + public function test_should_get_session_id(): void { $this->session->start(); @@ -39,7 +41,7 @@ public function testShouldGetSessionId(): void /** * @runInSeparateProcess */ - public function testShouldGetSessionIdIfNativeSessionWasStarted(): void + public function test_should_get_session_id_if_native_session_was_started(): void { session_start(); @@ -49,7 +51,7 @@ public function testShouldGetSessionIdIfNativeSessionWasStarted(): void /** * @runInSeparateProcess */ - public function testShouldReturnEmptyStringIfSessionIsUnstarted(): void + public function test_should_return_empty_string_if_session_is_unstarted(): void { $this->assertEquals('', $this->session->getId()); } @@ -57,7 +59,7 @@ public function testShouldReturnEmptyStringIfSessionIsUnstarted(): void /** * @runInSeparateProcess */ - public function testShouldBeAvailableFromTheFacade(): void + public function test_should_be_available_from_the_facade(): void { $facade = new SessionFacade(); diff --git a/tests/GetMethodTest.php b/tests/GetMethodTest.php index 707d952..ce098a4 100644 --- a/tests/GetMethodTest.php +++ b/tests/GetMethodTest.php @@ -7,6 +7,8 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * + * @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps */ namespace Josantonius\Session\Tests; @@ -29,7 +31,7 @@ public function setUp(): void /** * @runInSeparateProcess */ - public function testShouldGetAttributeIfExists(): void + public function test_should_get_attribute_if_exists(): void { $this->session->start(); @@ -41,7 +43,7 @@ public function testShouldGetAttributeIfExists(): void /** * @runInSeparateProcess */ - public function testShouldGetDefaultValueIfNotExists(): void + public function test_should_get_default_value_if_not_exists(): void { $this->session->start(); @@ -51,7 +53,7 @@ public function testShouldGetDefaultValueIfNotExists(): void /** * @runInSeparateProcess */ - public function testShouldGetCustomDefaultValueIfNotExists(): void + public function test_should_get_custom_default_value_if_not_exists(): void { $this->session->start(); @@ -61,7 +63,7 @@ public function testShouldGetCustomDefaultValueIfNotExists(): void /** * @runInSeparateProcess */ - public function testShouldGetAttributeDefinedOutsideLibrary(): void + public function test_should_get_attribute_defined_outside_library(): void { session_start(); @@ -73,7 +75,7 @@ public function testShouldGetAttributeDefinedOutsideLibrary(): void /** * @runInSeparateProcess */ - public function testShouldBeAvailableFromTheFacade(): void + public function test_should_be_available_from_the_facade(): void { $facade = new SessionFacade(); diff --git a/tests/GetNameMethodTest.php b/tests/GetNameMethodTest.php index 508e52d..88a558d 100644 --- a/tests/GetNameMethodTest.php +++ b/tests/GetNameMethodTest.php @@ -7,6 +7,8 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * + * @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps */ namespace Josantonius\Session\Tests; @@ -29,7 +31,7 @@ public function setUp(): void /** * @runInSeparateProcess */ - public function testShouldGetSessionName(): void + public function test_should_get_session_name(): void { $this->session->start(); @@ -39,7 +41,7 @@ public function testShouldGetSessionName(): void /** * @runInSeparateProcess */ - public function testShouldGetSessionNameIfNativeSessionWasStarted(): void + public function test_should_get_session_name_if_native_session_was_started(): void { session_start(); @@ -49,7 +51,7 @@ public function testShouldGetSessionNameIfNativeSessionWasStarted(): void /** * @runInSeparateProcess */ - public function testShouldReturnEmptyStringIfSessionIsUnstarted(): void + public function test_should_return_empty_string_if_session_is_unstarted(): void { $this->assertEquals('PHPSESSID', $this->session->getName()); } @@ -57,7 +59,7 @@ public function testShouldReturnEmptyStringIfSessionIsUnstarted(): void /** * @runInSeparateProcess */ - public function testShouldBeAvailableFromTheFacade(): void + public function test_should_be_available_from_the_facade(): void { $facade = new SessionFacade(); diff --git a/tests/HasMethodTest.php b/tests/HasMethodTest.php index 67bd3a3..7c211f7 100644 --- a/tests/HasMethodTest.php +++ b/tests/HasMethodTest.php @@ -7,6 +7,8 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * + * @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps */ namespace Josantonius\Session\Tests; @@ -29,7 +31,7 @@ public function setUp(): void /** * @runInSeparateProcess */ - public function testShouldCheckIfAttributeExists(): void + public function test_should_check_if_attribute_exists(): void { $this->session->start(); @@ -43,7 +45,7 @@ public function testShouldCheckIfAttributeExists(): void /** * @runInSeparateProcess */ - public function testShouldCheckAttributeDefinedOutsideLibrary(): void + public function test_should_check_attribute_defined_outside_library(): void { session_start(); @@ -55,7 +57,7 @@ public function testShouldCheckAttributeDefinedOutsideLibrary(): void /** * @runInSeparateProcess */ - public function testShouldBeAvailableFromTheFacade(): void + public function test_should_be_available_from_the_facade(): void { $facade = new SessionFacade(); diff --git a/tests/IsStartedMethodTest.php b/tests/IsStartedMethodTest.php index 083b379..f027a77 100644 --- a/tests/IsStartedMethodTest.php +++ b/tests/IsStartedMethodTest.php @@ -7,6 +7,8 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * + * @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps */ namespace Josantonius\Session\Tests; @@ -29,7 +31,7 @@ public function setUp(): void /** * @runInSeparateProcess */ - public function testShouldCheckIfSessionIsActive(): void + public function test_should_check_if_session_is_active(): void { $this->assertFalse($this->session->isStarted()); @@ -41,7 +43,7 @@ public function testShouldCheckIfSessionIsActive(): void /** * @runInSeparateProcess */ - public function testShouldBeAvailableFromTheFacade(): void + public function test_should_be_available_from_the_facade(): void { $facade = new SessionFacade(); diff --git a/tests/PullMethodTest.php b/tests/PullMethodTest.php index 9747ffc..1a88e0c 100644 --- a/tests/PullMethodTest.php +++ b/tests/PullMethodTest.php @@ -7,6 +7,8 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * + * @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps */ namespace Josantonius\Session\Tests; @@ -30,7 +32,7 @@ public function setUp(): void /** * @runInSeparateProcess */ - public function testShouldPullAttributeAndReturnTheValueIfExists(): void + public function test_should_pull_attribute_and_return_the_value_if_exists(): void { $this->session->start(); @@ -44,7 +46,7 @@ public function testShouldPullAttributeAndReturnTheValueIfExists(): void /** * @runInSeparateProcess */ - public function testShouldReturnDefaultValueIfAttributeNotExists(): void + public function test_should_return_default_value_if_attribute_not_exists(): void { $this->session->start(); @@ -54,7 +56,7 @@ public function testShouldReturnDefaultValueIfAttributeNotExists(): void /** * @runInSeparateProcess */ - public function testShouldReturnCustomDefaultValueIfAttributeNotExists(): void + public function test_should_return_custom_default_value_if_attribute_not_exists(): void { $this->session->start(); @@ -64,7 +66,7 @@ public function testShouldReturnCustomDefaultValueIfAttributeNotExists(): void /** * @runInSeparateProcess */ - public function testShouldFailIfSessionIsUnstarted() + public function test_should_fail_if_session_is_unstarted() { $this->expectException(SessionNotStartedException::class); @@ -74,7 +76,7 @@ public function testShouldFailIfSessionIsUnstarted() /** * @runInSeparateProcess */ - public function testShouldBeAvailableFromTheFacade(): void + public function test_should_be_available_from_the_facade(): void { $facade = new SessionFacade(); diff --git a/tests/RegenerateIdMethodTest.php b/tests/RegenerateIdMethodTest.php index 4030367..d5e621c 100644 --- a/tests/RegenerateIdMethodTest.php +++ b/tests/RegenerateIdMethodTest.php @@ -7,6 +7,8 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * + * @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps */ namespace Josantonius\Session\Tests; @@ -30,7 +32,7 @@ public function setUp(): void /** * @runInSeparateProcess */ - public function testShouldRegenerateSessionIdWithoutDeletingOldSession(): void + public function test_should_regenerate_session_id_without_deleting_old_session(): void { $this->session->start(); @@ -44,7 +46,7 @@ public function testShouldRegenerateSessionIdWithoutDeletingOldSession(): void /** * @runInSeparateProcess */ - public function testShouldRegenerateSessionIdDeletingOldSession(): void + public function test_should_regenerate_session_id_deleting_old_session(): void { $this->session->start(); @@ -58,7 +60,7 @@ public function testShouldRegenerateSessionIdDeletingOldSession(): void /** * @runInSeparateProcess */ - public function testShouldFailWhenRegenerateIdIfSessionIsUnstarted(): void + public function test_should_fail_when_regenerate_id_if_session_is_unstarted(): void { $this->expectException(SessionNotStartedException::class); @@ -68,7 +70,7 @@ public function testShouldFailWhenRegenerateIdIfSessionIsUnstarted(): void /** * @runInSeparateProcess */ - public function testShouldBeAvailableFromTheFacade(): void + public function test_should_be_available_from_the_facade(): void { $facade = new SessionFacade(); diff --git a/tests/RemoveMethodTest.php b/tests/RemoveMethodTest.php index 3cdfb7e..76aeed3 100644 --- a/tests/RemoveMethodTest.php +++ b/tests/RemoveMethodTest.php @@ -7,6 +7,8 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * + * @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps */ namespace Josantonius\Session\Tests; @@ -30,7 +32,7 @@ public function setUp(): void /** * @runInSeparateProcess */ - public function testShouldRemoveAttributeIfExist(): void + public function test_should_remove_attribute_if_exist(): void { $this->session->start(); @@ -44,7 +46,7 @@ public function testShouldRemoveAttributeIfExist(): void /** * @runInSeparateProcess */ - public function testShouldRemoveAttributeEvenIfNotExist(): void + public function test_should_remove_attribute_even_if_not_exist(): void { $this->session->start(); @@ -56,7 +58,7 @@ public function testShouldRemoveAttributeEvenIfNotExist(): void /** * @runInSeparateProcess */ - public function testShouldFailIfSessionIsUnstarted(): void + public function test_should_fail_if_session_is_unstarted(): void { $this->expectException(SessionNotStartedException::class); @@ -66,7 +68,7 @@ public function testShouldFailIfSessionIsUnstarted(): void /** * @runInSeparateProcess */ - public function testShouldBeAvailableFromTheFacade(): void + public function test_should_be_available_from_the_facade(): void { $facade = new SessionFacade(); diff --git a/tests/ReplaceMethodTest.php b/tests/ReplaceMethodTest.php index 1210c6a..f02a505 100644 --- a/tests/ReplaceMethodTest.php +++ b/tests/ReplaceMethodTest.php @@ -7,6 +7,8 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * + * @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps */ namespace Josantonius\Session\Tests; @@ -30,7 +32,7 @@ public function setUp(): void /** * @runInSeparateProcess */ - public function testShouldAddAttributesIfNotExist(): void + public function test_should_add_attributes_if_not_exist(): void { $this->session->start(); @@ -47,7 +49,7 @@ public function testShouldAddAttributesIfNotExist(): void /** * @runInSeparateProcess */ - public function testShouldReplaceAttributesIfExist(): void + public function test_should_replace_attributes_if_exist(): void { $this->session->start(); @@ -65,7 +67,7 @@ public function testShouldReplaceAttributesIfExist(): void /** * @runInSeparateProcess */ - public function testShouldFailIfSessionIsUnstarted(): void + public function test_should_fail_if_session_is_unstarted(): void { $this->expectException(SessionNotStartedException::class); @@ -75,7 +77,7 @@ public function testShouldFailIfSessionIsUnstarted(): void /** * @runInSeparateProcess */ - public function testShouldBeAvailableFromTheFacade(): void + public function test_should_be_available_from_the_facade(): void { $facade = new SessionFacade(); diff --git a/tests/SetIdMethodTest.php b/tests/SetIdMethodTest.php index 98c4f03..359d629 100644 --- a/tests/SetIdMethodTest.php +++ b/tests/SetIdMethodTest.php @@ -7,6 +7,8 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * + * @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps */ namespace Josantonius\Session\Tests; @@ -30,7 +32,7 @@ public function setUp(): void /** * @runInSeparateProcess */ - public function testShouldSetSessionId(): void + public function test_should_set_session_id(): void { $this->session->setId('foo'); @@ -42,7 +44,7 @@ public function testShouldSetSessionId(): void /** * @runInSeparateProcess */ - public function testShouldFailWhenSessionIsStarted(): void + public function test_should_fail_when_session_is_started(): void { $this->session->start(); @@ -54,7 +56,7 @@ public function testShouldFailWhenSessionIsStarted(): void /** * @runInSeparateProcess */ - public function testShouldBeAvailableFromTheFacade(): void + public function test_should_be_available_from_the_facade(): void { $facade = new SessionFacade(); diff --git a/tests/SetMethodTest.php b/tests/SetMethodTest.php index f578f8b..838cd9f 100644 --- a/tests/SetMethodTest.php +++ b/tests/SetMethodTest.php @@ -7,6 +7,8 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * + * @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps */ namespace Josantonius\Session\Tests; @@ -30,7 +32,7 @@ public function setUp(): void /** * @runInSeparateProcess */ - public function testShouldSetAttributeIfSessionWasStarted(): void + public function test_should_set_attribute_if_session_was_started(): void { $this->session->start(); @@ -42,7 +44,7 @@ public function testShouldSetAttributeIfSessionWasStarted(): void /** * @runInSeparateProcess */ - public function testShouldSetAttributeIfNativeSessionWasStarted(): void + public function test_should_set_attribute_if_native_session_was_started(): void { session_start(); @@ -54,7 +56,7 @@ public function testShouldSetAttributeIfNativeSessionWasStarted(): void /** * @runInSeparateProcess */ - public function testShouldFailIfSessionIsUnstarted(): void + public function test_should_fail_if_session_is_unstarted(): void { $this->expectException(SessionNotStartedException::class); @@ -64,7 +66,7 @@ public function testShouldFailIfSessionIsUnstarted(): void /** * @runInSeparateProcess */ - public function testShouldBeAvailableFromTheFacade(): void + public function test_should_be_available_from_the_facade(): void { $facade = new SessionFacade(); diff --git a/tests/SetNameMethodTest.php b/tests/SetNameMethodTest.php index 40c9273..3d9f2b5 100644 --- a/tests/SetNameMethodTest.php +++ b/tests/SetNameMethodTest.php @@ -7,6 +7,8 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * + * @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps */ namespace Josantonius\Session\Tests; @@ -30,7 +32,7 @@ public function setUp(): void /** * @runInSeparateProcess */ - public function testShouldSetSessionName(): void + public function test_should_set_session_name(): void { $this->session->setName('foo'); @@ -42,7 +44,7 @@ public function testShouldSetSessionName(): void /** * @runInSeparateProcess */ - public function testShouldFailWhenSessionIsStarted(): void + public function test_should_fail_when_session_is_started(): void { $this->session->start(); @@ -54,7 +56,7 @@ public function testShouldFailWhenSessionIsStarted(): void /** * @runInSeparateProcess */ - public function testShouldBeAvailableFromTheFacade(): void + public function test_should_be_available_from_the_facade(): void { $facade = new SessionFacade(); diff --git a/tests/StartMethodTest.php b/tests/StartMethodTest.php index c4dc738..e7e53d9 100644 --- a/tests/StartMethodTest.php +++ b/tests/StartMethodTest.php @@ -7,6 +7,8 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * + * @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps */ namespace Josantonius\Session\Tests; @@ -32,7 +34,7 @@ public function setUp(): void /** * @runInSeparateProcess */ - public function testShouldStartSession(): void + public function test_should_start_session(): void { $this->assertTrue($this->session->start()); @@ -44,7 +46,7 @@ public function testShouldStartSession(): void /** * @runInSeparateProcess */ - public function testShouldAcceptOptions(): void + public function test_should_accept_options(): void { $this->session->start(['cookie_lifetime' => 8000]); @@ -54,7 +56,7 @@ public function testShouldAcceptOptions(): void /** * @runInSeparateProcess */ - public function testShouldFailWithWrongOptions(): void + public function test_should_fail_with_wrong_options(): void { $this->expectException(WrongSessionOptionException::class); @@ -64,7 +66,7 @@ public function testShouldFailWithWrongOptions(): void /** * @runInSeparateProcess */ - public function testShouldFailWhenSessionIsAlreadyActive(): void + public function test_should_fail_when_session_is_already_active(): void { $this->session->start(); @@ -73,7 +75,7 @@ public function testShouldFailWhenSessionIsAlreadyActive(): void $this->session->start(); } - public function testShouldFailWhenHeadersSent(): void + public function test_should_fail_when_headers_sent(): void { $this->expectException(HeadersSentException::class); @@ -83,7 +85,7 @@ public function testShouldFailWhenHeadersSent(): void /** * @runInSeparateProcess */ - public function testShouldBeAvailableFromTheFacade(): void + public function test_should_be_available_from_the_facade(): void { $facade = new SessionFacade();