diff --git a/composer.json b/composer.json
index cd1b0b314..93f3f39e0 100644
--- a/composer.json
+++ b/composer.json
@@ -50,6 +50,7 @@
"twig/twig": "^2.12.1 || ^3.0"
},
"require-dev": {
+ "dama/doctrine-test-bundle": "^6.7",
"doctrine/annotations": "^1.13.3",
"friendsofphp/php-cs-fixer": "^3.4",
"matthiasnoback/symfony-dependency-injection-test": "^4.1.1",
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index dbe863873..d16fa273b 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -30,6 +30,10 @@ It's auto-generated by sonata-project/dev-kit package.
+
+
+
+
diff --git a/tests/App/AppKernel.php b/tests/App/AppKernel.php
index ee458e986..733b37858 100644
--- a/tests/App/AppKernel.php
+++ b/tests/App/AppKernel.php
@@ -13,6 +13,7 @@
namespace Sonata\PageBundle\Tests\App;
+use DAMA\DoctrineTestBundle\DAMADoctrineTestBundle;
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
use Knp\Bundle\MenuBundle\KnpMenuBundle;
use Sonata\AdminBundle\SonataAdminBundle;
@@ -52,6 +53,7 @@ public function __construct()
public function registerBundles(): iterable
{
$bundles = [
+ new DAMADoctrineTestBundle(),
new FrameworkBundle(),
new TwigBundle(),
new SecurityBundle(),
diff --git a/tests/Functional/Admin/PageAdminTest.php b/tests/Functional/Admin/PageAdminTest.php
new file mode 100644
index 000000000..ce01cc893
--- /dev/null
+++ b/tests/Functional/Admin/PageAdminTest.php
@@ -0,0 +1,93 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Sonata\PageBundle\Tests\Functional\Admin;
+
+use Doctrine\ORM\EntityManagerInterface;
+use Sonata\PageBundle\Tests\App\AppKernel;
+use Sonata\PageBundle\Tests\App\Entity\SonataPageBlock;
+use Sonata\PageBundle\Tests\App\Entity\SonataPagePage;
+use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
+use Symfony\Component\HttpKernel\KernelInterface;
+
+final class MediaAdminTest extends WebTestCase
+{
+ /**
+ * @dataProvider provideCrudUrlsCases
+ *
+ * @param array $parameters
+ */
+ public function testCrudUrls(string $url, array $parameters = []): void
+ {
+ $client = self::createClient();
+
+ $this->prepareData();
+
+ $client->request('GET', $url, $parameters);
+
+ self::assertResponseIsSuccessful();
+ }
+
+ /**
+ * @return iterable>>
+ *
+ * @phpstan-return iterable}>
+ */
+ public static function provideCrudUrlsCases(): iterable
+ {
+ yield 'Tree Page' => ['/admin/tests/app/sonatapagepage/tree'];
+
+ yield 'List Page' => ['/admin/tests/app/sonatapagepage/list', ['filter' => [
+ 'name' => ['value' => 'name'],
+ ]]];
+
+ yield 'Create Page' => ['/admin/tests/app/sonatapagepage/create'];
+ yield 'Edit Page' => ['/admin/tests/app/sonatapagepage/1/edit'];
+ yield 'Remove Page' => ['/admin/tests/app/sonatapagepage/1/delete'];
+ yield 'Compose Page' => ['/admin/tests/app/sonatapagepage/1/compose'];
+ yield 'Compose Show Page' => ['/admin/tests/app/sonatapagepage/compose/container/1'];
+ }
+
+ /**
+ * @return class-string
+ */
+ protected static function getKernelClass(): string
+ {
+ return AppKernel::class;
+ }
+
+ /**
+ * @psalm-suppress UndefinedPropertyFetch
+ */
+ private function prepareData(): void
+ {
+ // TODO: Simplify this when dropping support for Symfony 4.
+ // @phpstan-ignore-next-line
+ $container = method_exists($this, 'getContainer') ? self::getContainer() : self::$container;
+ $manager = $container->get('doctrine.orm.entity_manager');
+ \assert($manager instanceof EntityManagerInterface);
+
+ $page = new SonataPagePage();
+ $page->setName('name');
+ $page->setTemplateCode('default');
+
+ $block = new SonataPageBlock();
+ $block->setType('sonata.page.block.container');
+ $block->setPage($page);
+
+ $manager->persist($page);
+ $manager->persist($block);
+
+ $manager->flush();
+ }
+}