Skip to content

Commit

Permalink
bump routing
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed Apr 6, 2024
1 parent e526996 commit c6fe54b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 33 deletions.
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
],
"require": {
"php": "^8.1",
"symfony-cmf/routing": "^3.0",
"symfony-cmf/routing": "^3.0.3",
"symfony/framework-bundle": "^6.4 || ^7.0"
},
"require-dev": {
Expand All @@ -36,7 +36,7 @@
"symfony/translation": "^6.4 || ^7.0",
"symfony/validator": "^6.4 || ^7.0",
"symfony/twig-bundle": "^6.4 || ^7.0",
"symfony-cmf/testing": "dev-sf7 as 4.2.0",
"symfony-cmf/testing": "^5.0.1",
"twig/twig": "^2.4.4 || ^3.0"
},
"suggest": {
Expand Down Expand Up @@ -69,6 +69,5 @@
"allow-plugins": {
"composer/package-versions-deprecated": true
}
},
"minimum-stability": "dev"
}
}
23 changes: 10 additions & 13 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,36 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit
colors="true"
bootstrap="vendor/symfony-cmf/testing/bootstrap/bootstrap.php"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
>

<testsuites>
<testsuite name="unit tests">
<directory>./tests/Unit</directory>
</testsuite>

<testsuite name="functional tests with phpcr">
<directory>./tests/Functional</directory>
<exclude>./tests/Functional/Doctrine/Orm</exclude>
</testsuite>

<testsuite name="functional tests with orm">
<directory>./tests/Functional/Doctrine/Orm</directory>
</testsuite>
</testsuites>

<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<coverage includeUncoveredFiles="true">
<include>
<directory>src/</directory>
<exclude>
<directory>Resources/</directory>
</exclude>
</whitelist>
</filter>
</include>
<exclude>
<directory>src/Resources/</directory>
</exclude>
</coverage>

<php>
<env name="KERNEL_CLASS" value="\Symfony\Cmf\Bundle\RoutingBundle\Tests\Fixtures\App\Kernel" />
<env name="KERNEL_CLASS" value="\Symfony\Cmf\Bundle\RoutingBundle\Tests\Fixtures\App\Kernel"/>
</php>
</phpunit>
9 changes: 2 additions & 7 deletions src/Doctrine/Orm/RedirectRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,11 @@
* {@inheritdoc}
*
* Provides a redirect route stored in the Doctrine ORM and used as content for generic route to provide redirects
*
* @property int $id
*/
class RedirectRoute extends RedirectRouteModel
{
/**
* Unique id of this route.
*
* @var int
*/
protected $id;

protected string $serialisedParameters;

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/Fixtures/App/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class Kernel extends TestKernel
{
public function configure()
public function configure(): void
{
$this->requireBundleSet('default');

Expand All @@ -39,7 +39,7 @@ public function configure()
}
}

public function registerContainerConfiguration(LoaderInterface $loader)
public function registerContainerConfiguration(LoaderInterface $loader): void
{
$loader->load(__DIR__.'/config/config_'.$this->environment.'.php');
}
Expand Down
9 changes: 2 additions & 7 deletions tests/Functional/Doctrine/Orm/RedirectRouteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,21 @@
use Symfony\Cmf\Bundle\RoutingBundle\Controller\RedirectController;
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm\RedirectRoute;
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm\Route;
use Symfony\Component\HttpFoundation\RedirectResponse;

class RedirectRouteTest extends OrmTestCase
{
private $repository;

private $controller;
private RedirectController $controller;

public function setUp(): void
{
parent::setUp();
$this->clearDb(Route::class);
$this->clearDb(RedirectRoute::class);

$this->repository = $this->getContainer()->get('cmf_routing.route_provider');
$this->controller = new RedirectController($this->getContainer()->get('router'));
}

public function testRedirectDoctrine()
public function testRedirectDoctrine(): void
{
$route = $this->createRoute('route1', '/test');

Expand All @@ -52,7 +48,6 @@ public function testRedirectDoctrine()

$response = $this->controller->redirectAction($redirectRoute->getContent());

$this->assertInstanceOf(RedirectResponse::class, $response);
$this->assertSame(301, $response->getStatusCode());
$this->assertSame('http://localhost/test', $response->getTargetUrl());
}
Expand Down

0 comments on commit c6fe54b

Please sign in to comment.