+
{{ this.pagination.currentPage }}
+
+ {{ ux_pagination(
+ this.pagination,
+ linkAttributes: this.paginationLinkAttributes,
+ ) }}
+
diff --git a/src/Pagination/tests/Fixtures/templates/explicit.html.twig b/src/Pagination/tests/Fixtures/templates/explicit.html.twig
new file mode 100644
index 00000000000..776b31cf727
--- /dev/null
+++ b/src/Pagination/tests/Fixtures/templates/explicit.html.twig
@@ -0,0 +1 @@
+explicit template
diff --git a/src/Pagination/tests/Fixtures/templates/theme/custom.html.twig b/src/Pagination/tests/Fixtures/templates/theme/custom.html.twig
new file mode 100644
index 00000000000..46d6cc4e1d5
--- /dev/null
+++ b/src/Pagination/tests/Fixtures/templates/theme/custom.html.twig
@@ -0,0 +1 @@
+custom template
diff --git a/src/Pagination/tests/Integration/UXPaginationIntegrationTest.php b/src/Pagination/tests/Integration/UXPaginationIntegrationTest.php
new file mode 100644
index 00000000000..839acc9644f
--- /dev/null
+++ b/src/Pagination/tests/Integration/UXPaginationIntegrationTest.php
@@ -0,0 +1,583 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\UX\Pagination\Tests\Integration;
+
+use PHPUnit\Framework\Attributes\CoversNothing;
+use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
+use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
+use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
+use Symfony\Bundle\TwigBundle\TwigBundle;
+use Symfony\Component\Config\Loader\LoaderInterface;
+use Symfony\Component\DependencyInjection\Attribute\Autowire;
+use Symfony\Component\DependencyInjection\Attribute\Target;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\HttpKernel\Kernel;
+use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
+use Symfony\UX\LiveComponent\LiveComponentBundle;
+use Symfony\UX\LiveComponent\Test\InteractsWithLiveComponents;
+use Symfony\UX\Pagination\Pagination;
+use Symfony\UX\Pagination\PaginatorInterface;
+use Symfony\UX\Pagination\Tests\Fixtures\Entity\Author;
+use Symfony\UX\Pagination\Tests\Fixtures\EntityManagerFactory;
+use Symfony\UX\Pagination\Tests\Fixtures\LiveAutoRoutePaginationComponent;
+use Symfony\UX\Pagination\Tests\Fixtures\LivePaginationComponent;
+use Symfony\UX\Pagination\Twig\PaginationExtension;
+use Symfony\UX\Pagination\Twig\PaginationRenderer;
+use Symfony\UX\Pagination\UXPaginationBundle;
+use Symfony\UX\StimulusBundle\StimulusBundle;
+use Symfony\UX\TwigComponent\TwigComponentBundle;
+use Twig\Environment;
+
+/**
+ * Boots a real kernel with FrameworkBundle + TwigBundle + UXPaginationBundle
+ * and exercises the whole chain: container wiring, adapter discovery,
+ * Twig rendering with translations.
+ */
+#[CoversNothing]
+final class UXPaginationIntegrationTest extends KernelTestCase
+{
+ use InteractsWithLiveComponents;
+
+ protected static function getKernelClass(): string
+ {
+ return UXPaginationTestKernel::class;
+ }
+
+ public function testPaginatorServiceIsAutowirable()
+ {
+ self::bootKernel();
+
+ $paginator = self::getContainer()->get(PaginatorInterface::class);
+
+ self::assertInstanceOf(PaginatorInterface::class, $paginator);
+ }
+
+ public function testNamedPaginatorSupportsSymfonyAutowiringConventions()
+ {
+ self::bootKernel();
+
+ $consumer = self::getContainer()->get(NamedPaginatorConsumer::class);
+
+ self::assertSame($consumer->blogPaginator, $consumer->targetedPaginator);
+ self::assertSame($consumer->blogPaginator, $consumer->explicitPaginator);
+
+ $pagination = $consumer->blogPaginator->paginate(range(1, 120), page: 5);
+ self::assertSame(12, $pagination->getItemsPerPage());
+ self::assertSame('p', $pagination->getPageParameterName());
+ self::assertCount(8, $pagination->getPages());
+ }
+
+ public function testPaginatorIsInjectedIntoAControllerAction()
+ {
+ $kernel = self::bootKernel(['environment' => 'controller_injection']);
+ $request = Request::create('/_ux-pagination/controller');
+ $response = $kernel->handle($request);
+
+ self::assertSame(Response::HTTP_OK, $response->getStatusCode());
+ self::assertSame('Symfony\UX\Pagination\Paginator', $response->getContent());
+
+ $kernel->terminate($request, $response);
+ }
+
+ public function testRendererServiceIsConfigured()
+ {
+ self::bootKernel();
+
+ self::assertInstanceOf(
+ PaginationRenderer::class,
+ self::getContainer()->get('ux_pagination.renderer'),
+ );
+ }
+
+ public function testTwigRegistersThePaginationFunctions()
+ {
+ self::bootKernel();
+
+ /** @var Environment $twig */
+ $twig = self::getContainer()->get(Environment::class);
+
+ self::assertNotNull($twig->getFunction('ux_pagination'));
+ self::assertNull($twig->getFunction('pagination_head'));
+ }
+
+ public function testArrayAdapterIsWired()
+ {
+ self::bootKernel();
+
+ /** @var PaginatorInterface $paginator */
+ $paginator = self::getContainer()->get(PaginatorInterface::class);
+
+ $pagination = $paginator->paginate(range(1, 45), page: 2, perPage: 10);
+
+ self::assertInstanceOf(Pagination::class, $pagination);
+ self::assertSame(range(11, 20), $pagination->getItems());
+ self::assertSame(45, $pagination->getTotalItems());
+ self::assertSame(5, $pagination->getTotalPages());
+ }
+
+ public function testDoctrineOrmAdapterIsTagged()
+ {
+ if (!class_exists(\Doctrine\ORM\QueryBuilder::class)) {
+ self::markTestSkipped('Doctrine ORM is not installed.');
+ }
+
+ self::bootKernel();
+
+ $container = self::getContainer();
+
+ self::assertTrue($container->has('ux_pagination.adapter.doctrine_orm'));
+ }
+
+ public function testDoctrineDbalAdapterIsTagged()
+ {
+ if (!class_exists(\Doctrine\DBAL\Query\QueryBuilder::class)) {
+ self::markTestSkipped('Doctrine DBAL is not installed.');
+ }
+
+ self::bootKernel();
+
+ self::assertTrue(self::getContainer()->has('ux_pagination.adapter.doctrine_dbal'));
+ }
+
+ public function testTwigFunctionRendersNavigationWithTranslations()
+ {
+ self::bootKernel();
+
+ /** @var PaginatorInterface $paginator */
+ $paginator = self::getContainer()->get(PaginatorInterface::class);
+ /** @var Environment $twig */
+ $twig = self::getContainer()->get(Environment::class);
+
+ $pagination = $paginator->query(range(1, 100))
+ ->perPage(10)
+ ->path('/items')
+ ->paginate(page: 3);
+
+ $html = $twig->getRuntime(PaginationExtension::class)->renderPagination($pagination);
+
+ self::assertMatchesRegularExpression('/