Skip to content

Commit

Permalink
chore(monorepo): release v1.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
snicco-bot committed May 7, 2023
1 parent 4b7d40e commit 4df1c36
Show file tree
Hide file tree
Showing 10 changed files with 130 additions and 86 deletions.
116 changes: 58 additions & 58 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
"psr/http-message": "^1.0.0",
"psr/http-server-handler": "^1.0.0",
"psr/http-server-middleware": "^1.0.0",
"snicco/psr7-error-handler": "^1.6",
"snicco/str-arr": "^1.6",
"snicco/psr7-error-handler": "^1.6.1",
"snicco/str-arr": "^1.6.1",
"webimpress/safe-writer": "^2.2",
"webmozart/assert": "^1.10"
},
"require-dev": {
"phpunit/phpunit": "^9.5.13",
"pimple/pimple": "^3.5",
"snicco/http-routing-testing": "^1.6"
"snicco/http-routing-testing": "^1.6.1"
},
"suggest": {
"nyholm/psr7": "To use as a fast PSR7 implementation."
Expand All @@ -47,64 +47,64 @@
"sort-packages": true
},
"conflict": {
"snicco/testable-clock": "<1.6.0",
"snicco/signed-url": "<1.6.0",
"snicco/templating": "<1.6.0",
"snicco/testable-clock": "<1.6.1",
"snicco/signed-url": "<1.6.1",
"snicco/templating": "<1.6.1",
"snicco/psr7-error-handler": "<1.0.0",
"snicco/better-wpdb": "<1.6.0",
"snicco/better-wp-hooks": "<1.6.0",
"snicco/event-dispatcher": "<1.6.0",
"snicco/eloquent": "<1.6.0",
"snicco/better-wp-mail": "<1.6.0",
"snicco/better-wp-cache": "<1.6.0",
"snicco/session": "<1.6.0",
"snicco/better-wp-api": "<1.6.0",
"snicco/kernel": "<1.6.0",
"snicco/session-wp-bridge": "<1.6.0",
"snicco/session-psr16-bridge": "<1.6.0",
"snicco/blade-bridge": "<1.6.0",
"snicco/signed-url-psr16-bridge": "<1.6.0",
"snicco/illuminate-container-bridge": "<1.6.0",
"snicco/signed-url-psr15-bridge": "<1.6.0",
"snicco/pimple-bridge": "<1.6.0",
"snicco/no-robots-middleware": "<1.6.0",
"snicco/open-redirect-protection-middleware": "<1.6.0",
"snicco/better-wpdb": "<1.6.1",
"snicco/better-wp-hooks": "<1.6.1",
"snicco/event-dispatcher": "<1.6.1",
"snicco/eloquent": "<1.6.1",
"snicco/better-wp-mail": "<1.6.1",
"snicco/better-wp-cache": "<1.6.1",
"snicco/session": "<1.6.1",
"snicco/better-wp-api": "<1.6.1",
"snicco/kernel": "<1.6.1",
"snicco/session-wp-bridge": "<1.6.1",
"snicco/session-psr16-bridge": "<1.6.1",
"snicco/blade-bridge": "<1.6.1",
"snicco/signed-url-psr16-bridge": "<1.6.1",
"snicco/illuminate-container-bridge": "<1.6.1",
"snicco/signed-url-psr15-bridge": "<1.6.1",
"snicco/pimple-bridge": "<1.6.1",
"snicco/no-robots-middleware": "<1.6.1",
"snicco/open-redirect-protection-middleware": "<1.6.1",
"snicco/wp-capapility-middleware": "<1.0.0",
"snicco/wp-nonce-middleware": "<1.6.0",
"snicco/payload-middleware": "<1.6.0",
"snicco/default-headers-middleware": "<1.6.0",
"snicco/wp-auth-only-middleware": "<1.6.0",
"snicco/content-negotiation-middleware": "<1.6.0",
"snicco/redirect-middleware": "<1.6.0",
"snicco/must-match-route-middleware": "<1.6.0",
"snicco/method-override-middleware": "<1.6.0",
"snicco/share-cookies-middleware": "<1.6.0",
"snicco/https-only-middleware": "<1.6.0",
"snicco/wp-nonce-middleware": "<1.6.1",
"snicco/payload-middleware": "<1.6.1",
"snicco/default-headers-middleware": "<1.6.1",
"snicco/wp-auth-only-middleware": "<1.6.1",
"snicco/content-negotiation-middleware": "<1.6.1",
"snicco/redirect-middleware": "<1.6.1",
"snicco/must-match-route-middleware": "<1.6.1",
"snicco/method-override-middleware": "<1.6.1",
"snicco/share-cookies-middleware": "<1.6.1",
"snicco/https-only-middleware": "<1.6.1",
"snicco/guests-only-middleware": "<1.0.0",
"snicco/trailing-slash-middleware": "<1.6.0",
"snicco/testing-bundle": "<1.6.0",
"snicco/http-routing-bundle": "<1.6.0",
"snicco/debug-bundle": "<1.6.0",
"snicco/templating-bundle": "<1.6.0",
"snicco/better-wpdb-bundle": "<1.6.0",
"snicco/better-wp-hooks-bundle": "<1.6.0",
"snicco/blade-bundle": "<1.6.0",
"snicco/better-wp-mail-bundle": "<1.6.0",
"snicco/better-wp-cache-bundle": "<1.6.0",
"snicco/session-bundle": "<1.6.0",
"snicco/encryption-bundle": "<1.6.0",
"snicco/wp-guests-only-middleware": "<1.6.0",
"snicco/wp-capability-middleware": "<1.6.0",
"snicco/better-wp-mail-testing": "<1.6.0",
"snicco/session-testing": "<1.6.0",
"snicco/kernel-testing": "<1.6.0",
"snicco/signed-url-testing": "<1.6.0",
"snicco/http-routing-testing": "<1.6.0",
"snicco/event-dispatcher-testing": "<1.6.0",
"snicco/better-wp-cli": "<1.6.0",
"snicco/signed-url-wp-bridge": "<1.6.0",
"snicco/minimal-logger": "<1.6.0",
"snicco/better-wp-cli-testing": "<1.6.0"
"snicco/trailing-slash-middleware": "<1.6.1",
"snicco/testing-bundle": "<1.6.1",
"snicco/http-routing-bundle": "<1.6.1",
"snicco/debug-bundle": "<1.6.1",
"snicco/templating-bundle": "<1.6.1",
"snicco/better-wpdb-bundle": "<1.6.1",
"snicco/better-wp-hooks-bundle": "<1.6.1",
"snicco/blade-bundle": "<1.6.1",
"snicco/better-wp-mail-bundle": "<1.6.1",
"snicco/better-wp-cache-bundle": "<1.6.1",
"snicco/session-bundle": "<1.6.1",
"snicco/encryption-bundle": "<1.6.1",
"snicco/wp-guests-only-middleware": "<1.6.1",
"snicco/wp-capability-middleware": "<1.6.1",
"snicco/better-wp-mail-testing": "<1.6.1",
"snicco/session-testing": "<1.6.1",
"snicco/kernel-testing": "<1.6.1",
"snicco/signed-url-testing": "<1.6.1",
"snicco/http-routing-testing": "<1.6.1",
"snicco/event-dispatcher-testing": "<1.6.1",
"snicco/better-wp-cli": "<1.6.1",
"snicco/signed-url-wp-bridge": "<1.6.1",
"snicco/minimal-logger": "<1.6.1",
"snicco/better-wp-cli-testing": "<1.6.1"
},
"license": "LGPL-3.0-only",
"minimum-stability": "dev",
Expand Down
27 changes: 19 additions & 8 deletions tests/Middleware/MiddlewarePipelineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
use Snicco\Component\HttpRouting\Tests\helpers\CreateTestPsr17Factories;
use Snicco\Component\Psr7ErrorHandler\HttpErrorHandler;

use const SEEK_END;

/**
* @internal
*/
Expand Down Expand Up @@ -177,10 +179,11 @@ public function middleware_can_break_out_of_the_middleware_stack(): void
*/
public function middleware_can_be_resolved_from_the_container(): void
{
$this->pimple[MiddlewareWithDependencies::class] = fn (): MiddlewareWithDependencies => new MiddlewareWithDependencies(
new Foo('FOO'),
new Bar('BAR')
);
$this->pimple[MiddlewareWithDependencies::class] =
fn (): MiddlewareWithDependencies => new MiddlewareWithDependencies(
new Foo('FOO'),
new Bar('BAR')
);

$response = $this->pipeline
->send($this->request)
Expand Down Expand Up @@ -348,8 +351,12 @@ public function __construct(string $value_to_add = 'foo')
protected function handle(Request $request, NextMiddleware $next): ResponseInterface
{
$response = $next($request->withAttribute(self::ATTRIBUTE, $this->value_to_add));
$response->getBody()
->write(':pm1');

$body = $response->getBody();

$body->seek(0, SEEK_END);

$body->write(':pm1');

return $response;
}
Expand All @@ -372,8 +379,12 @@ public function __construct(string $value_to_add = 'bar')
protected function handle(Request $request, NextMiddleware $next): ResponseInterface
{
$response = $next->process($request->withAttribute(self::ATTRIBUTE, $this->value_to_add), $next);
$response->getBody()
->write(':pm2');

$body = $response->getBody();

$body->seek(0, SEEK_END);

$body->write(':pm2');

return $response;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
use Snicco\Component\HttpRouting\Tests\fixtures\TestDependencies\Foo;
use Snicco\Component\HttpRouting\Tests\HttpRunnerTestCase;

use const SEEK_END;

/**
* @internal
*/
Expand Down Expand Up @@ -159,8 +161,11 @@ protected function handle(Request $request, NextMiddleware $next): ResponseInter
{
$response = $next($request);

$response->getBody()
->write(':' . $this->foo->value . $this->bar->value . $this->baz . $this->biz);
$body = $response->getBody();

$body->seek(0, SEEK_END);

$body->write(':' . $this->foo->value . $this->bar->value . $this->baz . $this->biz);

return $response;
}
Expand Down
10 changes: 7 additions & 3 deletions tests/fixtures/BarMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Psr\Http\Message\ResponseInterface;
use Snicco\Component\HttpRouting\Http\Psr7\Request;
use Snicco\Component\HttpRouting\Middleware\Middleware;
use Snicco\Component\HttpRouting\Middleware\NextMiddleware;

final class BarMiddleware extends Middleware
{
Expand All @@ -17,12 +18,15 @@ public function __construct(string $bar = 'bar_middleware')
$this->bar = $bar;
}

protected function handle(Request $request, $next): ResponseInterface
protected function handle(Request $request, NextMiddleware $next): ResponseInterface
{
$response = $next($request);

$response->getBody()
->write(':' . $this->bar);
$body = $response->getBody();

$body->seek(0, SEEK_END);

$body->write(':' . $this->bar);

return $response;
}
Expand Down
9 changes: 6 additions & 3 deletions tests/fixtures/BazMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Psr\Http\Message\ResponseInterface;
use Snicco\Component\HttpRouting\Http\Psr7\Request;
use Snicco\Component\HttpRouting\Middleware\Middleware;
use Snicco\Component\HttpRouting\Middleware\NextMiddleware;

final class BazMiddleware extends Middleware
{
Expand All @@ -17,12 +18,14 @@ public function __construct(string $baz = 'baz_middleware')
$this->baz = $baz;
}

protected function handle(Request $request, $next): ResponseInterface
protected function handle(Request $request, NextMiddleware $next): ResponseInterface
{
$response = $next($request);

$response->getBody()
->write(':' . $this->baz);
$body = $response->getBody();
$body->seek(0, SEEK_END);

$body->write(':' . $this->baz);

return $response;
}
Expand Down
6 changes: 4 additions & 2 deletions tests/fixtures/BooleanMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ protected function handle(Request $request, NextMiddleware $next): ResponseInter
{
$response = $next($request);

$response->getBody()
->write(':' . $this->val);
$body = $response->getBody();
$body->seek(0, SEEK_END);

$body->write(':' . $this->val);

return $response;
}
Expand Down
13 changes: 10 additions & 3 deletions tests/fixtures/FooMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
use Snicco\Component\HttpRouting\Http\Psr7\Request;
use Snicco\Component\HttpRouting\Middleware\Middleware;

use Snicco\Component\HttpRouting\Middleware\NextMiddleware;

use const SEEK_END;

final class FooMiddleware extends Middleware
{
public string $foo;
Expand All @@ -17,12 +21,15 @@ public function __construct(string $foo = 'foo_middleware')
$this->foo = $foo;
}

protected function handle(Request $request, $next): ResponseInterface
protected function handle(Request $request, NextMiddleware $next): ResponseInterface
{
$response = $next($request);

$response->getBody()
->write(':' . $this->foo);
$body = $response->getBody();

$body->seek(0, SEEK_END);

$body->write(':' . $this->foo);

return $response;
}
Expand Down
12 changes: 9 additions & 3 deletions tests/fixtures/FoobarMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
use Snicco\Component\HttpRouting\Http\Psr7\Request;
use Snicco\Component\HttpRouting\Middleware\Middleware;

use Snicco\Component\HttpRouting\Middleware\NextMiddleware;

use const SEEK_END;

final class FoobarMiddleware extends Middleware
{
private string $val;
Expand All @@ -21,12 +25,14 @@ public function __construct(string $foo = null, string $bar = null)
}
}

protected function handle(Request $request, $next): ResponseInterface
protected function handle(Request $request, NextMiddleware $next): ResponseInterface
{
$response = $next($request);

$response->getBody()
->write(':' . $this->val);
$body = $response->getBody();
$body->seek(0, SEEK_END);

$body->write(':' . $this->val);

return $response;
}
Expand Down
7 changes: 5 additions & 2 deletions tests/fixtures/IntegerMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ protected function handle(Request $request, NextMiddleware $next): ResponseInter
{
$response = $next($request);

$response->getBody()
->write(':' . $this->val);
$body = $response->getBody();

$body->seek(0, SEEK_END);

$body->write(':' . $this->val);

return $response;
}
Expand Down
7 changes: 5 additions & 2 deletions tests/fixtures/MiddlewareWithDependencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
use Snicco\Component\HttpRouting\Tests\fixtures\TestDependencies\Bar;
use Snicco\Component\HttpRouting\Tests\fixtures\TestDependencies\Foo;

use const SEEK_END;

final class MiddlewareWithDependencies extends Middleware
{
public Foo $foo;
Expand All @@ -27,8 +29,9 @@ protected function handle(Request $request, NextMiddleware $next): ResponseInter
{
$response = $next($request);

$response->getBody()
->write(':' . $this->foo->value . $this->bar->value);
$body = $response->getBody();
$body->seek(0, SEEK_END);
$body->write(':' . $this->foo->value . $this->bar->value);

return $response;
}
Expand Down

0 comments on commit 4df1c36

Please sign in to comment.