From 8ab945fea2509178cc02dacad3c5bd8fc48ec1e0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Dec 2024 08:39:51 +0000 Subject: [PATCH 1/2] chore(deps): Bump archict/core from 1.0.3 to 1.1.0 Bumps [archict/core](https://github.com/Archict/core) from 1.0.3 to 1.1.0. - [Release notes](https://github.com/Archict/core/releases) - [Commits](https://github.com/Archict/core/compare/v1.0.3...v1.1.0) --- updated-dependencies: - dependency-name: archict/core dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 54 +++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/composer.lock b/composer.lock index d32312e..40e0700 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "archict/brick", - "version": "v1.0.2", + "version": "v1.0.3", "source": { "type": "git", "url": "https://github.com/Archict/brick.git", - "reference": "08157bd1ffa3298807fdb0f83dd8b94095e86e43" + "reference": "088dab658b538c86c359e3062d7f940aaead35e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Archict/brick/zipball/08157bd1ffa3298807fdb0f83dd8b94095e86e43", - "reference": "08157bd1ffa3298807fdb0f83dd8b94095e86e43", + "url": "https://api.github.com/repos/Archict/brick/zipball/088dab658b538c86c359e3062d7f940aaead35e9", + "reference": "088dab658b538c86c359e3062d7f940aaead35e9", "shasum": "" }, "require": { @@ -42,22 +42,22 @@ "description": "Base library for Archict framework", "support": { "issues": "https://github.com/Archict/brick/issues", - "source": "https://github.com/Archict/brick/tree/v1.0.2" + "source": "https://github.com/Archict/brick/tree/v1.0.3" }, - "time": "2024-12-07T10:09:59+00:00" + "time": "2024-12-30T08:32:46+00:00" }, { "name": "archict/core", - "version": "v1.0.3", + "version": "v1.1.0", "source": { "type": "git", "url": "https://github.com/Archict/core.git", - "reference": "70f4c22e3cfa69868c39c96e6b0b8c73223fdec1" + "reference": "fb870528d47c9ef7f7b561bd7acbb917734ae7a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Archict/core/zipball/70f4c22e3cfa69868c39c96e6b0b8c73223fdec1", - "reference": "70f4c22e3cfa69868c39c96e6b0b8c73223fdec1", + "url": "https://api.github.com/repos/Archict/core/zipball/fb870528d47c9ef7f7b561bd7acbb917734ae7a8", + "reference": "fb870528d47c9ef7f7b561bd7acbb917734ae7a8", "shasum": "" }, "require": { @@ -91,9 +91,9 @@ "description": "Heart of Archict, this library load and manage Bricks", "support": { "issues": "https://github.com/Archict/core/issues", - "source": "https://github.com/Archict/core/tree/v1.0.3" + "source": "https://github.com/Archict/core/tree/v1.1.0" }, - "time": "2024-12-07T10:28:25+00:00" + "time": "2024-12-30T08:37:47+00:00" }, { "name": "azjezz/psl", @@ -135,8 +135,8 @@ "type": "library", "extra": { "thanks": { - "name": "hhvm/hsl", - "url": "https://github.com/hhvm/hsl" + "url": "https://github.com/hhvm/hsl", + "name": "hhvm/hsl" } }, "autoload": { @@ -270,13 +270,13 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "3.x-dev" - }, "phpstan": { "includes": [ "extension.neon" ] + }, + "branch-alias": { + "dev-main": "3.x-dev" } }, "autoload": { @@ -942,12 +942,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -1080,8 +1080,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -1159,8 +1159,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -1233,8 +1233,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { From 17fb63bf0d3898726bd34566418b0af6ec33e13f Mon Sep 17 00:00:00 2001 From: Kevin Traini Date: Mon, 30 Dec 2024 09:45:00 +0100 Subject: [PATCH 2/2] fix: Missing param to ServiceManager in tests --- tests/unit/Route/RouteCollectionTest.php | 43 ++++++++++++++---------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/tests/unit/Route/RouteCollectionTest.php b/tests/unit/Route/RouteCollectionTest.php index 64be414..ad26dad 100644 --- a/tests/unit/Route/RouteCollectionTest.php +++ b/tests/unit/Route/RouteCollectionTest.php @@ -34,15 +34,24 @@ use Archict\Router\Method; use Archict\Router\RequestHandler; use Archict\Router\ResponseFactory; +use CuyZ\Valinor\Mapper\TreeMapper; +use CuyZ\Valinor\MapperBuilder; use PHPUnit\Framework\TestCase; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; final class RouteCollectionTest extends TestCase { + private TreeMapper $mapper; + + protected function setUp(): void + { + $this->mapper = (new MapperBuilder())->enableFlexibleCasting()->allowSuperfluousKeys()->allowPermissiveTypes()->mapper(); + } + public function testItCanAddRouteWithRequestHandler(): void { - $collection = new RouteCollection(new ServiceManager()); + $collection = new RouteCollection(new ServiceManager($this->mapper)); self::assertTrue( $collection->addRoute( Method::GET, @@ -59,7 +68,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface // ph public function testItCanAddRouteWithCallable(): void { - $collection = new RouteCollection(new ServiceManager()); + $collection = new RouteCollection(new ServiceManager($this->mapper)); self::assertTrue( $collection->addRoute(Method::GET, 'route', static fn(ServerRequestInterface $request) => ResponseFactory::build()->get()) // phpcs:ignore ); @@ -67,7 +76,7 @@ public function testItCanAddRouteWithCallable(): void public function testItCanAddRouteWithClassname(): void { - $collection = new RouteCollection(new ServiceManager()); + $collection = new RouteCollection(new ServiceManager($this->mapper)); $handler = new class implements RequestHandler { public function handle(ServerRequestInterface $request): ResponseInterface // phpcs:ignore { @@ -79,7 +88,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface // ph public function testItNotAcceptIfAddTwiceSameRoute(): void { - $collection = new RouteCollection(new ServiceManager()); + $collection = new RouteCollection(new ServiceManager($this->mapper)); self::assertTrue( $collection->addRoute(Method::GET, 'route', static fn(ServerRequestInterface $request) => ResponseFactory::build()->get()) // phpcs:ignore ); @@ -90,7 +99,7 @@ public function testItNotAcceptIfAddTwiceSameRoute(): void public function testItAcceptSameRouteDifferentMethod(): void { - $collection = new RouteCollection(new ServiceManager()); + $collection = new RouteCollection(new ServiceManager($this->mapper)); self::assertTrue( $collection->addRoute(Method::GET, 'route', static fn(ServerRequestInterface $request) => ResponseFactory::build()->get()) // phpcs:ignore ); @@ -101,7 +110,7 @@ public function testItAcceptSameRouteDifferentMethod(): void public function testItNotAcceptSameRouteWithMethodAll(): void { - $collection = new RouteCollection(new ServiceManager()); + $collection = new RouteCollection(new ServiceManager($this->mapper)); self::assertTrue( $collection->addRoute(Method::GET, 'route', static fn(ServerRequestInterface $request) => ResponseFactory::build()->get()) // phpcs:ignore ); @@ -112,7 +121,7 @@ public function testItNotAcceptSameRouteWithMethodAll(): void public function testItNotAcceptSameRouteIfFirstIsMethodAll(): void { - $collection = new RouteCollection(new ServiceManager()); + $collection = new RouteCollection(new ServiceManager($this->mapper)); self::assertTrue( $collection->addRoute(Method::ALL, 'route', static fn(ServerRequestInterface $request) => ResponseFactory::build()->get()) // phpcs:ignore ); @@ -123,7 +132,7 @@ public function testItNotAcceptSameRouteIfFirstIsMethodAll(): void public function testItAcceptSeveralRoute(): void { - $collection = new RouteCollection(new ServiceManager()); + $collection = new RouteCollection(new ServiceManager($this->mapper)); self::assertTrue( $collection->addRoute(Method::GET, 'route1', static fn(ServerRequestInterface $request) => ResponseFactory::build()->get()) // phpcs:ignore ); @@ -137,7 +146,7 @@ public function testItAcceptSeveralRoute(): void public function testItAcceptSameRouteWithDifferentGroup(): void { - $collection = new RouteCollection(new ServiceManager()); + $collection = new RouteCollection(new ServiceManager($this->mapper)); self::assertTrue( $collection->addRoute(Method::GET, '{group:\d+}', static fn(ServerRequestInterface $request) => ResponseFactory::build()->get()) // phpcs:ignore ); @@ -148,14 +157,14 @@ public function testItAcceptSameRouteWithDifferentGroup(): void public function testItThrowIfRouteNotFound(): void { - $collection = new RouteCollection(new ServiceManager()); + $collection = new RouteCollection(new ServiceManager($this->mapper)); self::expectException(NotFoundException::class); $collection->getMatchingRoute('', 'GET'); } public function testItThrowIfMethodNotAllowed(): void { - $collection = new RouteCollection(new ServiceManager()); + $collection = new RouteCollection(new ServiceManager($this->mapper)); $collection->addRoute(Method::GET, 'route', static fn(ServerRequestInterface $request) => ResponseFactory::build()->get()); // phpcs:ignore self::expectException(MethodNotAllowedException::class); $collection->getMatchingRoute('route', 'POST'); @@ -163,7 +172,7 @@ public function testItThrowIfMethodNotAllowed(): void public function testItCanFindMatchingRouteSimple(): void { - $collection = new RouteCollection(new ServiceManager()); + $collection = new RouteCollection(new ServiceManager($this->mapper)); $collection->addRoute(Method::ALL, 'route', static fn(ServerRequestInterface $request) => ResponseFactory::build()->get()); // phpcs:ignore $route = $collection->getMatchingRoute('route', 'PATCH'); @@ -173,7 +182,7 @@ public function testItCanFindMatchingRouteSimple(): void public function testItCanFindMatchingRouteWithGroup(): void { - $collection = new RouteCollection(new ServiceManager()); + $collection = new RouteCollection(new ServiceManager($this->mapper)); $collection->addRoute(Method::GET, 'article/{id:\d+}', static fn(ServerRequestInterface $request) => ResponseFactory::build()->get()); // phpcs:ignore $route = $collection->getMatchingRoute('article/5', 'GET'); @@ -183,28 +192,28 @@ public function testItCanFindMatchingRouteWithGroup(): void public function testItCanAddMiddlewareWithCallable(): void { - $collection = new RouteCollection(new ServiceManager()); + $collection = new RouteCollection(new ServiceManager($this->mapper)); self::expectNotToPerformAssertions(); $collection->addMiddleware(Method::GET, 'route', static fn(ServerRequestInterface $request) => $request); } public function testItCanAddMiddlewareWithMiddleware(): void { - $collection = new RouteCollection(new ServiceManager()); + $collection = new RouteCollection(new ServiceManager($this->mapper)); self::expectNotToPerformAssertions(); $collection->addMiddleware(Method::GET, 'route', new IdentityMiddlewareStub()); } public function testItCanAddMiddlewareWithClassname(): void { - $collection = new RouteCollection(new ServiceManager()); + $collection = new RouteCollection(new ServiceManager($this->mapper)); self::expectNotToPerformAssertions(); $collection->addMiddleware(Method::GET, 'route', IdentityMiddlewareStub::class); } public function testItAcceptMultipleMiddlewareOnSameRoute(): void { - $collection = new RouteCollection(new ServiceManager()); + $collection = new RouteCollection(new ServiceManager($this->mapper)); self::expectNotToPerformAssertions(); $collection->addMiddleware(Method::GET, 'route', new IdentityMiddlewareStub()); $collection->addMiddleware(Method::GET, 'route', new IdentityMiddlewareStub());