From ee1aa42900fc36bb4f962f54a9eef43ec093a75b Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 7 Jun 2020 09:00:41 +0200 Subject: [PATCH 1/4] Improved titles on error templates --- module/Core/templates/error/404.phtml | 2 +- module/Core/templates/invalid-short-code.phtml | 2 +- module/Core/templates/layout/default.phtml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/module/Core/templates/error/404.phtml b/module/Core/templates/error/404.phtml index bd1b0b6f..20ac4ff8 100644 --- a/module/Core/templates/error/404.phtml +++ b/module/Core/templates/error/404.phtml @@ -1,7 +1,7 @@ layout('ShlinkCore::layout/default') ?> start('title') ?> - URL Not Found + Not Found end() ?> start('stylesheets') ?> diff --git a/module/Core/templates/invalid-short-code.phtml b/module/Core/templates/invalid-short-code.phtml index a435ba0b..47be4a16 100644 --- a/module/Core/templates/invalid-short-code.phtml +++ b/module/Core/templates/invalid-short-code.phtml @@ -1,7 +1,7 @@ layout('ShlinkCore::layout/default') ?> start('title') ?> - Invalid URL + Invalid Short URL end() ?> start('stylesheets') ?> diff --git a/module/Core/templates/layout/default.phtml b/module/Core/templates/layout/default.phtml index b231d48b..fbb78b26 100644 --- a/module/Core/templates/layout/default.phtml +++ b/module/Core/templates/layout/default.phtml @@ -1,7 +1,7 @@ - <?= $this->section('title', '') ?> | URL shortener + <?= $this->section('title', '') ?> | Shlink From 68919c19b812d9aa31884cfb020926d65259fec2 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 7 Jun 2020 10:33:58 +0200 Subject: [PATCH 2/4] Added deprecation in BodyParserMiddleware --- module/Rest/src/Middleware/BodyParserMiddleware.php | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/module/Rest/src/Middleware/BodyParserMiddleware.php b/module/Rest/src/Middleware/BodyParserMiddleware.php index 955041d9..c7e99121 100644 --- a/module/Rest/src/Middleware/BodyParserMiddleware.php +++ b/module/Rest/src/Middleware/BodyParserMiddleware.php @@ -19,12 +19,6 @@ use function trim; class BodyParserMiddleware implements MiddlewareInterface, RequestMethodInterface { - /** - * Process an incoming server request and return a response, optionally delegating - * to the next middleware component to create the response. - * - * - */ public function process(Request $request, RequestHandlerInterface $handler): Response { $method = $request->getMethod(); @@ -51,8 +45,6 @@ class BodyParserMiddleware implements MiddlewareInterface, RequestMethodInterfac return $handler->handle($this->parseFromUrlEncoded($request)); } - /** - */ private function getRequestContentType(Request $request): string { $contentType = $request->getHeaderLine('Content-type'); @@ -60,8 +52,6 @@ class BodyParserMiddleware implements MiddlewareInterface, RequestMethodInterfac return trim(array_shift($contentTypes)); } - /** - */ private function parseFromJson(Request $request): Request { $rawBody = (string) $request->getBody(); @@ -74,6 +64,7 @@ class BodyParserMiddleware implements MiddlewareInterface, RequestMethodInterfac } /** + * @deprecated To be removed on Shlink v3.0.0, supporting only JSON requests. */ private function parseFromUrlEncoded(Request $request): Request { From 2867a9b7b0c10c51d1043768be5c67fa4ef35ab6 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 7 Jun 2020 11:23:32 +0200 Subject: [PATCH 3/4] Added commands to run infection checks on database tests --- CHANGELOG.md | 2 +- composer.json | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6192481f..1b58f000 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this #### Changed -* *Nothing* +* [#508](https://github.com/shlinkio/shlink/issues/508) Added mutation checks to database tests. #### Deprecated diff --git a/composer.json b/composer.json index ef9e0e92..777463b2 100644 --- a/composer.json +++ b/composer.json @@ -115,27 +115,31 @@ "@test:db" ], "test:unit": "phpdbg -qrr vendor/bin/phpunit --order-by=random --colors=always --coverage-php build/coverage-unit.cov --testdox", - "test:unit:ci": "@test:unit --coverage-clover=build/clover.xml --coverage-xml=build/coverage-xml --log-junit=build/junit.xml", + "test:unit:ci": "@test:unit --coverage-clover=build/clover.xml --coverage-xml=build/coverage-unit/coverage-xml --log-junit=build/coverage-unit/junit.xml", "test:db": [ - "@test:db:sqlite", + "@test:db:sqlite:ci", "@test:db:mysql", "@test:db:maria", "@test:db:postgres", "@test:db:ms" ], - "test:db:sqlite": "APP_ENV=test phpdbg -qrr vendor/bin/phpunit --order-by=random --colors=always --coverage-php build/coverage-db.cov --testdox -c phpunit-db.xml", + "test:db:sqlite": "APP_ENV=test phpdbg -qrr vendor/bin/phpunit --order-by=random --colors=always --testdox -c phpunit-db.xml", + "test:db:sqlite:ci": "@test:db:sqlite --coverage-php build/coverage-db.cov --coverage-xml=build/coverage-db/coverage-xml --log-junit=build/coverage-db/junit.xml", "test:db:mysql": "DB_DRIVER=mysql composer test:db:sqlite", "test:db:maria": "DB_DRIVER=maria composer test:db:sqlite", "test:db:postgres": "DB_DRIVER=postgres composer test:db:sqlite", "test:db:ms": "DB_DRIVER=mssql composer test:db:sqlite", "test:api": "bin/test/run-api-tests.sh", - "test:api:ci": "@test:api --coverage-php build/coverage-api.cov", "test:unit:pretty": "phpdbg -qrr vendor/bin/phpunit --order-by=random --colors=always --coverage-html build/coverage", "infect": "infection --threads=4 --min-msi=80 --log-verbosity=default --only-covered", - "infect:ci": "@infect --coverage=build --skip-initial-tests", - "infect:show": "@infect --show-mutations", + "infect:ci:base": "@infect --skip-initial-tests", + "infect:ci": [ + "@infect:ci:base --coverage=build/coverage-unit", + "@infect:ci:base --coverage=build/coverage-db --test-framework-options=--configuration=phpunit-db.xml" + ], "infect:test": [ "@test:unit:ci", + "@test:db:sqlite:ci", "@infect:ci" ], "clean:dev": "rm -f data/database.sqlite && rm -f config/params/generated_config.php" @@ -158,7 +162,6 @@ "test:unit:pretty": "Runs unit test suites and generates an HTML code coverage report", "infect": "Checks unit tests quality applying mutation testing", "infect:ci": "Checks unit tests quality applying mutation testing with existing reports and logs", - "infect:show": "Checks unit tests quality applying mutation testing and shows applied mutators", "infect:test": "Checks unit tests quality applying mutation testing", "clean:dev": "Deletes artifacts which are gitignored and could affect dev env" }, From 248209ab41a0a5b26126238d2538d022b9e695ae Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Mon, 8 Jun 2020 23:30:19 +0200 Subject: [PATCH 4/4] Updated changelog --- CHANGELOG.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b58f000..6993aeb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,29 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org). +## [Unreleased] + +#### Added + +* *Nothing* + +#### Changed + +* [#508](https://github.com/shlinkio/shlink/issues/508) Added mutation checks to database tests. + +#### Deprecated + +* *Nothing* + +#### Removed + +* *Nothing* + +#### Fixed + +* *Nothing* + + ## 2.2.2 - 2020-06-08 #### Added @@ -12,7 +35,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this #### Changed -* [#508](https://github.com/shlinkio/shlink/issues/508) Added mutation checks to database tests. +* *Nothing* #### Deprecated