Skip to content

Commit 8e2b68d

Browse files
committed
1137: Fixed typo, added test
1 parent 5a80b50 commit 8e2b68d

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/Controller/ApiV1RedirectController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ class ApiV1RedirectController extends AbstractController
1313
#[Route('/v1/{endpoint}', name: 'app_api_v1_redirect', requirements: ['endpoint' => '.+'], defaults: ['endpoint' => null], methods: ['GET'])]
1414
public function index(string $endpoint): RedirectResponse
1515
{
16-
return $this->redirect('/v2'.$endpoint, 301);
16+
return $this->redirect('/v2/'.$endpoint, 301);
1717
}
1818
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace App\Tests\Controller;
4+
5+
use App\Controller\ApiV1RedirectController;
6+
use PHPUnit\Framework\TestCase;
7+
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
8+
9+
class ApiV1RedirectControllerTest extends WebTestCase
10+
{
11+
public function testIndex()
12+
{
13+
$client = static::createClient();
14+
$crawler = $client->request('GET', '/v1/screens/01GN9PW2Z03V8VQG7SN6Q9R17H');
15+
16+
$this->assertResponseRedirects('/v2/screens/01GN9PW2Z03V8VQG7SN6Q9R17H', 301);
17+
18+
$client->followRedirect();
19+
$this->assertResponseIsSuccessful();
20+
}
21+
}

0 commit comments

Comments
 (0)