From 358c0a3a89e3275be34c339cb974130bf792ac76 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Wed, 30 Jun 2021 10:27:36 -0500 Subject: [PATCH] qa: remove BC breaks and ensure conforms to CS guidelines - Removes docblock headers from new files - Ensures all types are documented in new interface and test assets - Do not have SameSiteCookieCapableInterface extend ConfigInterface, and StandardConfig implement SameSiteCookieCapableInterface; instead, have StandarConfig implement both ConfigInterface and SameSiteCookieCapableInterface. Signed-off-by: Matthew Weier O'Phinney --- docs/book/config.md | 2 +- src/Config/SameSiteCookieCapableInterface.php | 16 ++-- src/Config/StandardConfig.php | 2 +- src/Service/SessionConfigFactory.php | 3 +- test/Service/SessionConfigFactoryTest.php | 6 +- test/TestAsset/TestConfig.php | 96 +++++++++++++------ 6 files changed, 80 insertions(+), 45 deletions(-) diff --git a/docs/book/config.md b/docs/book/config.md index c32948d6..b6568bc7 100644 --- a/docs/book/config.md +++ b/docs/book/config.md @@ -22,7 +22,7 @@ Option | Data Type | Description `cookie_httponly` | `boolean` | Marks the cookie as accessible only through the HTTP protocol. `cookie_lifetime` | `integer` | Specifies the lifetime of the cookie in seconds which is sent to the browser. `cookie_path` | `string` | Specifies path to set in the session cookie. -`cookie_samesite` | `string` | Specifies whether cookies should be sent along with cross-site requests. +`cookie_samesite` | `string` | Specifies whether cookies should be sent along with cross-site requests. (Since 2.11.0) `cookie_secure` | `boolean` | Specifies whether cookies should only be sent over secure connections. `entropy_length` | `integer` | Specifies the number of bytes which will be read from the file specified in entropy_file. Removed in PHP 7.1.0. `entropy_file` | `string` | Defines a path to an external resource (file) which will be used as an additional entropy. Removed in PHP 7.1.0. diff --git a/src/Config/SameSiteCookieCapableInterface.php b/src/Config/SameSiteCookieCapableInterface.php index 60e8c794..2f5af695 100644 --- a/src/Config/SameSiteCookieCapableInterface.php +++ b/src/Config/SameSiteCookieCapableInterface.php @@ -1,15 +1,15 @@ [ - 'config_class' => TestConfig::class, + 'config_class' => TestConfig::class, 'cookie_samesite' => 'Lax', ], ] ); $this->expectException(ServiceNotCreatedException::class); - $this->expectExceptionMessage('Invalid configuration class "LaminasTest\Session\TestAsset\TestConfig". When configuration option "cookie_samesite" is used, the configuration class must implement Laminas\Session\Config\SameSiteCookieCapableInterface'); + $this->expectExceptionMessage('"cookie_samesite"'); $this->services->get(ConfigInterface::class); } } diff --git a/test/TestAsset/TestConfig.php b/test/TestAsset/TestConfig.php index 55b73835..82de07cc 100644 --- a/test/TestAsset/TestConfig.php +++ b/test/TestAsset/TestConfig.php @@ -1,134 +1,168 @@