diff --git a/src/Http/Middleware/PasswordProtected.php b/src/Http/Middleware/PasswordProtected.php index 2a8aa27..319d3a4 100644 --- a/src/Http/Middleware/PasswordProtected.php +++ b/src/Http/Middleware/PasswordProtected.php @@ -32,7 +32,10 @@ protected function handlePasswordProtected(): ?ResponseInterface $context = Timber::context(); $context['post'] = new Post(); - $html = Timber::compile('single-password.twig', $context); + $html = Timber::compile( + apply_filters('lumberjack/password_protect_template', 'single-password.twig'), + $context + ); if (!$html) { return null; diff --git a/tests/Unit/Http/Middleware/PasswordProtectTest.php b/tests/Unit/Http/Middleware/PasswordProtectTest.php index 8148c7b..7ab55f1 100644 --- a/tests/Unit/Http/Middleware/PasswordProtectTest.php +++ b/tests/Unit/Http/Middleware/PasswordProtectTest.php @@ -5,7 +5,7 @@ use Mockery; use Timber\Timber; use Brain\Monkey\Functions; -use Laminas\Diactoros\Response\HtmlResponse; +use Brain\Monkey\Filters; use PHPUnit\Framework\TestCase; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; @@ -110,5 +110,6 @@ public function it_renders_the_password_template_when_needed() $middleware = new PasswordProtected; $this->assertSame('testing123', $middleware->process($request, $handler)->getBody()->getContents()); + $this->assertTrue(Filters\applied('lumberjack/password_protect_template') > 0); } }